PDA

View Full Version : Proper use of Requery in a form



Gingertrees
08-15-2011, 12:17 PM
My tblEmployee links to my tblBusiness (I already know what business the employees belong to, I'm just using the businessID to join the two records).

I want to enter the employee's info:
name / other irrelevant fields / city of employ
John Smith / ... ... ... / New York
and based on the city name, I want a multi-column dropdown of all the businessIDs, businessnames, and businesscity 's in my tblbusiness that match that city
(ideal: "close to" that city, so I could enter "New" and get "New Brunswick", "New York", etc, but I may be hoping for too much there):
201 / Acme Inc. / New York
322 / Rabbit Co. / New Yorkshire
etc

So eventually my record could appear as
John Smith / ... ... ... / New York / 201

Currently, I have a form based on a query that limits cities as follows: "WHERE [tblBusiness].[businesscity]=[tblEmployee].[city]"

But what that does is create a parameter box, which is a pain and doesn't work when I move to a new record. (e.g. Adam Jones of Portland would still have only the New York-like options appear for his record)

I believe Requery is my answer, but I don't know how to phrase that correctly. Do I put it in a function, or a private sub, or just in the After Update property? I have no idea. Please help. (BTW, for whatever reason, this crazy database that I inherited does NOT create new modules when I create a new form).

HiTechCoach
08-16-2011, 09:55 AM
Sounds like you need a cascading combo box.

See if this example helps:
Cascading Combo Boxes Database (http://www.candace-tripp.net/download/cascadecombo2k.zip)
Demonstrates how to make combo boxes whose values are filtered by the value of other combo boxes in a cascade.