If not on list

G

Guest

Below are the fields on my table that I am attempting to select information:

State: AZ Name: Phoenix Locality Name: Phoenix, AZ State Name: Arizona
State: AZ Name: Tucson Locality Name: Tucson, AZ State Name: Arizona

The query prompts them for a selection of the state first, then the name.
As you can see, there are 2 records for AZ with different names. They enter
Phoenix for the name and it returns all of the information for the record
Phoenix. Now my problem is, if they enter a "Name" in AZ that is not on the
list, like Tucson or Phoenix, I want it to print out "Arizona" in the
locality field. If the "Name" in AZ is on the list then it will select the
Locality Name record.

I have tried a lot of things and figure I need some sort of If statement to
go here but am truly stumped.

Thank you in advance,
Diane
 
G

Guest

My code is as follows:

Private Sub Locality_Name_GotFocus()
If [Name] <> [Locality_Name] Then
[State_Name]
Else: [Locality Name] = [State]
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top