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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use msg box?

Status
Not open for further replies.

HJessen

Technical User
Dec 18, 2002
39
US
We have a DB where we track both the local residence and the legal residence of individuals working in our office. What I am trying to do is setup a form so that when it appears:
- If the Legal Residence is blank then produce a msg box that asks if the local and legal residence are the same.
- If they are the same, just copy the information from one field to another.
- If they are not the same, then go to the legal residence field and wait for input.
- If the Legel Residence is not blank, then do nothing.

It might be that we do not know if they are the same, so the 'macro' must run everytime the form is opened.

The problem I have is that I can't the msg box to work. Am I using the wrong tool here? Any suggestions?

THANKS. H. Jessen
"Now I know more, and I feel dummer"
 
I would insert the code into the OnCurrent event of the form. You may need to call this code from other places also. For example, if the user enters a new address.

Here's an example:

If (IsNull(LegalResidence)) And (Not IsNull(LocalResidence)) Then
If (MsgBox("Is the Legal Residence the same as the Local Residence?", vbYesNo) = vbYes) Then
LegalResidence = LocalResidence
Else
LegalResidence.SetFocus
End If
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top