Informative message box

marissela7

New member
Local time
Today, 03:07
Joined
Jul 31, 2018
Messages
3
Hi,

I'm not an expert on vba but i've worked with several forms and databases on the past. Im working on a form right now that has a subform with many entries per user and the point is to record all travels per user. I need to have a msgbox pop-up everytime a field matches a country that requires a visa and for this I thought of using IF but nothing pops up after entering the value on the field.. any thoughts?
 
Something like this assuming you have a Yes/No field to indicate which countries need a visa

Code:
If DLookup("VisaNeededField","YourTableName", "Country = '" & Me.ControlName & "'")=True Then
     MsgBox "Need a visa for this country"
End If
 
Thank you!!!! I will give it a try right away.
 
From a design stand point, rather than a pop up, you may wish to have a subform that lists "Travel Requirements". These would be child records to the "Country" table. After making a selection in your combo box for "Country", you set the filter for the subform to be Country=Me.CboDestinationCountry and do a requery.

Your subform would normally be set as Country="" so you don't get any records (OR as "No requirements" display, if you want to be tricky about it).

This is because, as you go forward, just needing a visa won't be the only thing you'll need to show. Immunizations, lead time for clearance, or special training may also be items you'll otherwise need to create popups for.

Just HATE to have you start adding a lot of extra fields into a table as you go along only to discover putting that into a separate table NOW makes your life so much easier.

SPECIAL NOTE: Means you could also have "FromDate" and "ThruDate" in your table for periodic travel bans...
 

Users who are viewing this thread

Back
Top Bottom