1 Replies - 1593 Views - Last Post: 25 January 2014 - 08:56 AM

#1 Rabastan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 27-August 12

Auto Populate City and State

Posted 25 January 2014 - 08:05 AM

I am trying to build an Employee Database for my company. I cant figure out why this is not working. I want to Auto Populate the city and state based on the zip code entered. for txtEmployeeZip I have the following

Private Sub txtEmployeeZip_AfterUpdate()
    txtEmployeeCity = DLookup("[zipCity]", "tblZip", "[zipCode]= '" & Me!txtEmployeeZip & "'")
    txtEmployeeState = DLookup("[zipState]", "tblZip", "[zipCode]= '" & Me!txtEmployeeZip & "'")
End Sub



It however does NOTHING. I have double checked 10 times and all my field names are corecct. It won't let me

Thanks, Rab

Attached File(s)



Is This A Good Question/Topic? 0
  • +

Replies To: Auto Populate City and State

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2885
  • View blog
  • Posts: 9,570
  • Joined: 12-December 12

Re: Auto Populate City and State

Posted 25 January 2014 - 08:56 AM

I find the square brackets needs to used in this order:

txtEmployeeCity = DLookup("zipCity", "[tblZip]", "[zipCode]= '" & Me!txtEmployeeZip & "'")

..despite what the help system says.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1