Re: Combo boxes for Form Query




"Larry Linson" <bouncer@xxxxxxxxxxxxx> wrote in message
news:JnUWf.16905$W75.4526@xxxxxxxxxxx

"jim" <jimwmct@xxxxxxxxx> wrote

>I have created a Table that has 13 fields
> and 2 Primary Keys, e.g. 60 1, 60
> 2, ... 60 28, 61 1, 61 2, ... 61 28, etc...

Just for the record <pun intended>, a Record can have either no Primary
Key
or one Primary Key. What you describe is a multi-field Primary Key, that
is,
a single Primary Key composed of two Fields.

Create an unbound Combo Box, showing all the values of the first Field of
your Primary Key. Create a second unbound Combo Box, with a query for Row
Source that uses the first Combo Box value as criteria for that Field, and
shows the values of the second Field of the Primary Key to be selected. In
the After Update event of the first Combo Box, Requery the second Combo
Box.
In the AfterUpdate event of the second Combo Box, use the contents of both
Combo Boxes to construct the WHERE clause, or WhereContition argument of a
DoCmd.OpenForm (or DoCmd.OpenReport).

In my "linked Combo Box searches" I set the Enabled property of the second
Combo Box to No in Design View, and enable it in code in the AfterUpdate
event of the first Combo, just prior to Requerying. That prevents the user
from entering the second Field first and causing confusion (though if you
are careful, you can make it work "going either way").

Larry Linson
Microsoft Access MVP


Thanks for the help.
Some of what you say is new to me, I will try to work thru it.
Thanks


.



Relevant Pages

  • Re: Different types of Boxes
    ... You need to requery the combobox, but after the new value is saved. ... Or get fancy and set variable to True in the Before update event if the ... An unbound text box is usually used as a calculated control. ...
    (microsoft.public.access.gettingstarted)
  • Re: Form recordset question
    ... Actually my combo box is unbound and uses the Row Source ... After Update event I use a bookmark to show the ... >its ControlSource set to a field in the form's ... >Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.formscoding)
  • RE: Different types of Boxes
    ... After Update event of the bound text box to change the value in the combo: ... and a Bound Text Box as my "Display / Edit! ... An unbound text box is usually used as a calculated control. ... it is improper to store it in a table. ...
    (microsoft.public.access.gettingstarted)
  • Re: Store Part of Entry
    ... I have been able to populate the text from the unbound ... text box after update event as you suggested. ... >use the code mentioned to take the right 9 digits from ... >After thinking more about this entry form, ...
    (microsoft.public.access.formscoding)
  • Re: Select Button
    ... Update event you can set the control source for the text box: ... unbound text box, and YourText is the name of the query field. ... You could also adapt this code to make a text box visible or not, as Brian ...
    (microsoft.public.access.forms)