Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / March 2006

Tip: Looking for answers? Try searching our database.

Combo boxes for Form Query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jim - 30 Mar 2006 05:46 GMT
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...
I want to create a Form where I can input the Primary Key values to query
the Form to
show the 13 fields assigned to the Primary key pair.  If I create 2 Combo
boxes I can only
get the see the assignments for the first Primary Key, or only for the
second Primary Key.
I can't see how to get the lookup to use both Primary Keys.

appreciate any help
Jim
Larry Linson - 30 Mar 2006 18:16 GMT
>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

> I want to create a Form where I can input the Primary Key values to query
> the Form to
[quoted text clipped - 6 lines]
> appreciate any help
> Jim
jim - 31 Mar 2006 06:07 GMT
>  >I have created a Table that has 13 fields
>  > and 2 Primary Keys, e.g. 60  1, 60
[quoted text clipped - 21 lines]
>   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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.