MsgBox Help with Yes/No

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I want to ask a question with the MsgBox. When I run code I get a message
that says wrong number of arguments. Can I get some help. Thanks

If Me.ITEM_TYPE <> "F" And Me.PROD_FAM = "STMP" Then
Me.AR_CODE = "107"
MsgBox "Is this item a Spare Steam Part? Click Yes. Or used to build _
Steam Products? Click No.", vbYesNo, "AP CODE Question", , ,_ VbMsgBoxResult
If VbMsgBoxResult = vbYes Then
Me.AP_CODE = "1260"
Else
Me.AP_CODE = "1220"
End If
 
K

Ken Snell [MVP]

Too many arguments for MsgBox. Change this line of code:

MsgBox "Is this item a Spare Steam Part? Click Yes. Or used to build _
Steam Products? Click No.", vbYesNo, "AP CODE Question", , ,_ VbMsgBoxResult


to this (what I've posted is one line of code, so watch for line-wrapping by
your newsreader):

VbMsgBoxResult = MsgBox("Is this item a Spare Steam Part? Click Yes. Or
used to build Steam Products? Click No.", vbYesNo, "AP CODE Question")
 
M

mattc66 via AccessMonster.com

Ok that worked. Do you know if I can do the following? Have 2 things in my IF
statment and if both match go to the THEN? It doesn't seem to be working as I
intended.

If Me.ITEM_TYPE = "F" And Me.PROD_FAM = "STMP" Then
Too many arguments for MsgBox. Change this line of code:

MsgBox "Is this item a Spare Steam Part? Click Yes. Or used to build _
Steam Products? Click No.", vbYesNo, "AP CODE Question", , ,_ VbMsgBoxResult

to this (what I've posted is one line of code, so watch for line-wrapping by
your newsreader):

VbMsgBoxResult = MsgBox("Is this item a Spare Steam Part? Click Yes. Or
used to build Steam Products? Click No.", vbYesNo, "AP CODE Question")
I want to ask a question with the MsgBox. When I run code I get a message
that says wrong number of arguments. Can I get some help. Thanks
[quoted text clipped - 9 lines]
Me.AP_CODE = "1220"
End If
 
K

Ken Snell [MVP]

Yes, your syntax for the multiple test within one IF...THEN statement is
correct. So if it's not working, either something is wrong with the logic,
or one of your controls/fields doesn't contain the value that you expect.

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


mattc66 via AccessMonster.com said:
Ok that worked. Do you know if I can do the following? Have 2 things in my
IF
statment and if both match go to the THEN? It doesn't seem to be working
as I
intended.

If Me.ITEM_TYPE = "F" And Me.PROD_FAM = "STMP" Then
Too many arguments for MsgBox. Change this line of code:

MsgBox "Is this item a Spare Steam Part? Click Yes. Or used to build _
Steam Products? Click No.", vbYesNo, "AP CODE Question", , ,_
VbMsgBoxResult

to this (what I've posted is one line of code, so watch for line-wrapping
by
your newsreader):

VbMsgBoxResult = MsgBox("Is this item a Spare Steam Part? Click Yes.
Or
used to build Steam Products? Click No.", vbYesNo, "AP CODE Question")
I want to ask a question with the MsgBox. When I run code I get a message
that says wrong number of arguments. Can I get some help. Thanks
[quoted text clipped - 9 lines]
Me.AP_CODE = "1220"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top