How can I update all data in a form by typing a zip code in the zip code field

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

How can I update all data in a form by typing a zip code
in the zip code field?
The db open with a start up form and when you click on
repsbyzip button it prompts to enter a zip code and then
opens the form "repsbyzip". Once the "repsbyzip" form is
open, I wanna be able to enter a new zip code in the zip
code field and auto updates all info for that zip in
the "repsbyzip" form. The form gets its data from a query
and I use criteria Like [ZIP Code:] in this query.
Basically, I do not want to close and open the form
everytime I wanna see reps info for each zip code. Plese
help me. Thank you.
Kevin
 
Put an unbound text box in the header of the "repsbyzip" form. Name this
textbox txtZipCode.

Put this code on the AfterUpdate event of this textbox:
Private Sub txtZipCode_AfterUpdate()
Me.Requery
End Sub

Change the query by replacing
[ZIP Code:]
with
[Forms]![repsbyzip]![txtZipCode]

When you enter a zip code in your textbox and hit Enter key, the form will
display the records associated with the value in the textbox.
 
Back
Top