473,769 Members | 8,267 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2093

"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.OpenRepor t).

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*****@localh ost.not> wrote in message
news:JnUWf.1690 5$W75.4526@trnd dc07...

"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.OpenRepor t).

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
3321
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 about 3 years and I'm more rusty than I thought I was. Anyway, in a nutshell: The scenario: 2 combo boxes (comboLastName and comboStateorProvince) on a form with 30 text boxes, the form's recordsource has been set to a query, both combo boxes and...
0
3537
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 form, I set the rowsources of its, and its subforms', combo boxes in the "Enter" events of the combo boxes. That's the standard trick for not loading the rowsource unless/until the user actually needs the combo box. For example:
1
2714
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 relate addresses (multiple addresses); companies, contacts, and tasks to each project (one to many). My challenge lies with the task sub-form which links to the Project form through ProjID. The task record links back to the respective master...
4
2610
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 two unbound text boxes, txtExamTitle and txtExamNumber. The user enters either the exam title in txtExamTitle or the exam number in txtExamNumber as a parameter for the query. This is currently working fine, however because the exam titles are...
0
2390
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 data to be manipulated easily. The combo box uses "Row Source Type" = Table/Query. The "Row Source" references a query to extract a distinct list of data.
4
7192
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) how to use the selection "All" as criteria for a field in a query, which is used to generate data for a report.
2
3070
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 displays data dependent on what has been typed in. After having trouble with populating my second combo box (I eventually populated it by putting the fields for both combo boxes in 1 separate query) I am now having problems with the 3rd one and am...
5
3702
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 just choose the appropriate criterias from the combo boxes to get the results. I also want the query to run even if there is not a value in all the combo boxes ie., i want just all males with income level of over $100,000...Any insights or help...
4
64637
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 determines the available options in the other. TERMINOLOGY Row Source: The table/query from which the Combo Box or List Box gets its values. Note: There are other types of row sources that can be used but for simplicity we will stick with Tables...
0
2916
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 front end on their local machine. The main form of the database has several query driven combo boxes. These queries pull data from the back end database to populate the combo boxes.
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.