MsgBox (1 Viewer)

Mark.Innes

Registered User.
Local time
Today, 14:35
Joined
Dec 10, 2003
Messages
15
I am having a few problems displaying a msgbox based on a populated field.

What I need is a bit of code that says on update of a combo box, if the word in this box = the same word in a specific field on a table then display a message

Any ideas please?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:35
Joined
Feb 19, 2002
Messages
43,328
You can use DLookup() to retrieve a single value from a recordset (query or table).
 

Mark.Innes

Registered User.
Local time
Today, 14:35
Joined
Dec 10, 2003
Messages
15
Thanks,

I have tried the Dlookup ("myquery") >0 Then
Mrkmsg = msgbox("message", VBokonly)

But I get a message saying

Compile error: Argument not optional

Any idea's please
 

R6Flyer

Yamaha hooligan
Local time
Today, 14:35
Joined
Nov 21, 2003
Messages
95
This is straight off the top of my head so may not be what you are looking for.

Try placing the following code on the afterupdate event of your combo box:

If DLookUp("[Specific Field Name]","Specific table name","[Lookup Field In Table]=[Field name on form]")=me.YourComboName Then

Msgbox "Your message here"

End If

This assumes that the bound column in your combo is the same as the column displayed by the combo and the match is exact.

If the criteria is not met then nothing will happen, otherwise your message should appear.

Cheers

Flyer
 

Users who are viewing this thread

Top Bottom