Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using If, Then, Else to generate message

Status
Not open for further replies.

MCRK6275

Programmer
Oct 13, 2003
3
US
I'm trying to force users to key information in a field based on a Yes or No field. The yes or no field is "Foreign Address" and if they answer yes they must type the name of the country in the "Country Name" field. The message can simply state "Please type country". Please help..
 
I'm pretty new to this myself but I'll give it a shot. Also there's not much information to go by, like how/when you want this prompt to activate, from where, whether option buttons are used, or a checkbox, etc. But wherever you launch it from the code should be something like this:

If [yourcontrol]=yes Then
Msgbox "Please Type Country",vbInformation,"Foreign Country"
'code to add the record here
End If
 
I'm basically trying to ensure that if a foreign address feild, which is a Yes/No nox, is selected, that the program checks the "Country Name" field to make sure it's filled in. I want the prompt to activate after the "Country Name" is updated. It's coming from a form...Thanks for your help..
 
Another way is to put this code in the After Update event for the yes/no field:

Dim Country

If Me![ForeignAddress] = yes Then
Country = InputBox("Please Enter Country", "Foreign Country")
Me![CountryName] = Country
End I


If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top