Fill in the blank

S

StormWater1

I want my form the fill in the blank field(s) dependant upon what has been
selected in a previous field.
I have Table1 (unique numbers for permits) and Table2 (all inspected
permits). There are 3 fields that are common to both Tables: LdaID, LdaName,
LdaLocal.
When I input the LdaId on the form (or Table2), I want the fields LdaName
and LdaLocal automatically filled in.
Thanks in advance, guys.
 
G

Golfinray

You probably want a filter. Add a combo box to your form. Use the combo box
wizard to do this for you and let it select the field you want to search or
filter on (this would likely be LdaID.) Once the combo is built, right click
on it to get properties, go to events, find the afterupdate event, start the
code builder with the little button out to the right and type:
Me.filter = "[LdaID] = """ & Me.Combo# & """"
Me. Filteron = true
The combo#, like combo1 or combo20 will be listed when you start the code
builder. Now when you start the form, you should be able to scroll to the
LdaID number you want and your other information will come up.
 
K

Klatuu

There is a basic flaw in your design and that is why you are having this
problem.
You should not have two separate tables. You should have one permits table
with a field that identifies that status of the permit.
When you want to see only only one status (inspected, not inspected, etc),
filter your form on that field.
 
S

StormWater1

To be clear about this, my goal is to populate the 2 fields (LdaName &
LdaLocal) in a form (Permit Inspects) when 1 field (LdaID) is supplied. How
is this filter statement constructed in the Form design (lookup tab). Thanks
again
 
J

John W. Vinson

To be clear about this, my goal is to populate the 2 fields (LdaName &
LdaLocal) in a form (Permit Inspects) when 1 field (LdaID) is supplied. How
is this filter statement constructed in the Form design (lookup tab). Thanks
again

If you are trying to COPY the LdaName and LdaLocal fields from one table into
another table - you're violating a very basic principle of relational design.
Storing data redundantly (the same LdaName in two different tables) is to be
avoided.

If you just want to *DISPLAY* the name on the form, include the two fields in
the combo box's RowSource query and add two textboxes with control sources
like

=comboboxname.Column(n)

where n is the zero-based index of the field in the query - that is, if
LdaName is the third field in the query use (2).
 

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