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

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
 
K

Ken Snell

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.
 

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