Custom Msgbox

echorley

Registered User.
Local time
Yesterday, 23:54
Joined
Mar 11, 2003
Messages
131
In my football statistics database, I would like a message box to popup that indicates who scored. For example, if Detroit scores a touchdown, a message box would appear saying Touchdown Detroit. I know that I can simply code

MsgBox("Touchdown Detroit", vbOKCancel) = vbOK

but the teams that are playing are selected on another screen (the switchboard).

I have tried this:

Dim strOpponent As String
strOpponent = Forms![Switchboard]![Opponent]
MsgBox("Touchdown " & strOpponent & "!", vbOKCancel) = vbOK

but the message box simply says Touchdown.

I am think the mistake is in the strOpponent line, but I cannot figure out what it is or what to do.
Thanks for any help.
 
It's interesting that your code even ran! Why don't you try this:
MsgBox "Touchdown " & strOpponent & "!", vbExclamation

By enclosing the parameters in parentheses, you are using the MsgBox function, not the MsgBox action. You don't need to record whether the user pressed OK or Cancel.
 
Excellent!

Hey that worked perfectly! Thanks much.
 

Users who are viewing this thread

Back
Top Bottom