Help please with MsgBox..
Dear Experts,
What code should be added in order my codes run as follow:
VB Code:
MsgBox "Item has been updated.", vbOKOnly, "Update Success"
If vbOKOnly ?????? Then
TextBox3.Text = rst.Fields("Qty")
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
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:
Dim Res as vbMsgBoxResult
Res=MsgBox("Question?", vbYesNo, "Title")
If Res = vbYes Then
'Do something
End If
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.
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.
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:
if item is updated then (or if not 'error then)
msgbox "item updated"
textbox3.text = rst.fields("Qty")
else
'counter condition
end if
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...???? :confused:
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...???? :confused:
Yes.