Results 1 to 7 of 7

Thread: Help please with MsgBox..

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Help please with MsgBox..

    Dear Experts,

    What code should be added in order my codes run as follow:

    VB Code:
    1. MsgBox "Item has been updated.", vbOKOnly, "Update Success"
    2.         If vbOKOnly ?????? Then
    3.             TextBox3.Text = rst.Fields("Qty")
    4.             End If

    I give ???? because I dont know what should I type in order after press "OK" then it will show on the text box number .i.e. 3....

    Please let me know...

    Thanks very much

    Jennifer

  2. #2
    Addicted Member Bregalad's Avatar
    Join Date
    Jul 2000
    Location
    Oslo,Norway
    Posts
    183

    Re: Help please with MsgBox..

    If you have vbOKOnly there is no need for an If, because the MsgBox will always return vbOK. If you need to get a yes/no answer you will have to change the parameter in MsgBox to vbYesNo.

    VB Code:
    1. Dim Res as vbMsgBoxResult
    2. Res=MsgBox("Question?", vbYesNo, "Title")
    3. If Res = vbYes Then
    4.    'Do something
    5. End If

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Help please with MsgBox..

    Since there is only one button on the message box, you don't need any kind of IF statement. Just put your textbox.text line right below the msgbox line.

  4. #4
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Help please with MsgBox..

    I don't know what you are trying to do exactly, but looking at your post you may want to think about using a Message Box with the Yes/No buttons like in Bregalad's post and putting you your function inside of the IF-Then Statement.

    Just my two cents.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  5. #5
    Lively Member
    Join Date
    Jan 2006
    Posts
    110

    Re: Help please with MsgBox..

    or... you can use the if-then statements before the condition you posted and after posting the message box post the action

    VB Code:
    1. if item is updated then (or if not 'error then)
    2.  msgbox "item updated"
    3.  textbox3.text = rst.fields("Qty")
    4. else
    5.  'counter condition
    6. end if

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: Help please with MsgBox..

    Hi,

    I have already tried that codes but still does not work...do you want me to show you the whole codes...so, you can have a look what is going on...????

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Help please with MsgBox..

    Quote Originally Posted by zach007
    Hi,

    I have already tried that codes but still does not work...do you want me to show you the whole codes...so, you can have a look what is going on...????
    Yes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width