473,395 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Combo boxes for Form Query

jim
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
Mar 30 '06 #1
2 2057

"jim" <ji*****@yahoo.com> 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

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

Mar 30 '06 #2
jim

"Larry Linson" <bo*****@localhost.not> wrote in message
news:JnUWf.16905$W75.4526@trnddc07...

"jim" <ji*****@yahoo.com> 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
Mar 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: FZ | last post by:
Hi Gang, I was wondering if a generous person might be able to walk me through what I believe is a pretty simple task. I actually have significant Access experience, but I haven't done it in...
0
by: Krisa | last post by:
Hello all, I just discovered something (stop me if you've heard this before....) that was causing me a significant performance hit when opening a form with subforms. To speed up loading the...
1
by: Robert Neville | last post by:
The solution to my dilemma seems straight-forward, yet my mind has not been forthcoming with a direct route. My Project form has a tab control with multiple sub-forms; these distinct sub-forms...
4
by: RBohannon | last post by:
I'm using Access 2000. I currently have a report being generated using the results of a query by form. The form used for this query is an unbound form, frmListDialog. frmListDialog contains...
0
by: Andrew | last post by:
Hello, I am trying to create a chart whose underlying query is linked to 2 combo boxes on the same form. I want to pass the values from the combo boxes into the chart query to allow the chart...
4
by: meganrobertson22 | last post by:
Hi Everyone- I have a question about how to add and then use the "All" selection in a combo box. I am trying to figure out how to: (1) add "All" as a selection to a combo box and then (2)...
2
by: visionstate | last post by:
Hi there, I am working on a form that uses 3 text boxes and 3 combo boxes. When any data is entered into any of these, I click a command button and this requeries a sub query in the form and...
5
by: jjyconsulting | last post by:
Newbie needing some help. I have a tblParticipants. The fields include gender, education_level, income, occupation etc., I'm trying to create a form where a user can run a query from the form and...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
0
by: Del | last post by:
Hello and thanks for any and all assistance! I have a database that is used by several users on several different machines. The backend database is housed on a file server. Each user has a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.