MsgBox

Mark.Innes

Registered User.
Local time
Today, 08:44
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?
 
You can use DLookup() to retrieve a single value from a recordset (query or table).
 
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
 
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

Back
Top Bottom