473,783 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combobox selection to query

Access 2003 (2000 file format) question:

When I run a form, it opens with only a combo box and a button to
execute a query based on the criteria tha is selected in the combobox.
Then I need Access to open a report using that query.

Can someone give me some pointers on how to do this, or please point me
in the direction I need to look for this answer?

Thanks,
Ray
Nov 13 '05 #1
3 5610
Ray Holtz wrote:
Access 2003 (2000 file format) question:

When I run a form, it opens with only a combo box and a button to
execute a query based on the criteria tha is selected in the combobox.
Then I need Access to open a report using that query.

Can someone give me some pointers on how to do this, or please point me
in the direction I need to look for this answer?


Perhaps the easiest way to do this is to first create the query you wish
to have as the recordsource for the report. Use some test criteria.
Set up your report to work as you require.

Next, create the form and the combo box.

Now, go back to the query and open it in design view. Where you have
the criteria beneath a field in the design view, replace it with:

[Forms]![frmName]![cboName]

And save it.

Next you can create a button on your form, and the command button wizard
is helpful here, to open the form.

Voila!
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #2
Hmm, I tried that just now, and after I select from the combobox, and
click the button to open the Report, it brings up a message box for the
query asking to enter a parameter value and says
"Forms!FrmWhich Dept!CboWhichDe pt" and a text box for me to type in. I
am trying to skip this step where it asks the user to type the
department name. This is so the user doesn't have to remember the whole
department name and type it exactly as Access knows it. Rather they
just select it from a combo box.
Thanks, but any other suggestions... anyone?
Tim Marshall wrote:
Ray Holtz wrote:
Access 2003 (2000 file format) question:

When I run a form, it opens with only a combo box and a button to
execute a query based on the criteria tha is selected in the
combobox. Then I need Access to open a report using that query.

Can someone give me some pointers on how to do this, or please point
me in the direction I need to look for this answer?

Perhaps the easiest way to do this is to first create the query you wish
to have as the recordsource for the report. Use some test criteria. Set
up your report to work as you require.

Next, create the form and the combo box.

Now, go back to the query and open it in design view. Where you have
the criteria beneath a field in the design view, replace it with:

[Forms]![frmName]![cboName]

And save it.

Next you can create a button on your form, and the command button wizard
is helpful here, to open the form.

Voila!

Nov 13 '05 #3
Ok, I had a button calling a macro that first closed the form, then
opened the report, I have it opening the report then close the 1st form
and it works great!
Thanks Tim, you helped me A LOT!
Ray

Tim Marshall wrote:
Ray Holtz wrote:
Access 2003 (2000 file format) question:

When I run a form, it opens with only a combo box and a button to
execute a query based on the criteria tha is selected in the
combobox. Then I need Access to open a report using that query.

Can someone give me some pointers on how to do this, or please point
me in the direction I need to look for this answer?

Perhaps the easiest way to do this is to first create the query you wish
to have as the recordsource for the report. Use some test criteria. Set
up your report to work as you require.

Next, create the form and the combo box.

Now, go back to the query and open it in design view. Where you have
the criteria beneath a field in the design view, replace it with:

[Forms]![frmName]![cboName]

And save it.

Next you can create a button on your form, and the command button wizard
is helpful here, to open the form.

Voila!

Nov 13 '05 #4

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

Similar topics

3
7495
by: Wayne Wengert | last post by:
I am trying to populate a combobox with a lisy of items. I want the 1st item to be "Make a Selection" and the following items will be names from a table in my DB (See code below). When I run the project, the combox box initially displays an empty selection. When I click on the drop down arrow I see the "Make a Selection" followed by the other choices. How can I move everything up so that the "Make a Selection" is the default value in...
1
1972
by: Steve | last post by:
I have a continuous form with several unbound comboboxes in the form header. The comboboxes are used to provide criteria for the SQL of the form. The code behind the form looks like: Public Sub FormSQL() Dim SQLStr As String SQLStr = < Code to build SQL String based on selection in comboboxes> SQLStr = SQLStr & ";" Me.RecordSource = SQLStr End Sub
5
3082
by: Steve | last post by:
I have an unbound combobox in the form header of a continuous form. The selection in the combobox sets the where clause in a querydef which determines QryPFrmInventoryManagement. The following code is in the afterupdate event of the combobox: Me.RecordSource = "QryPFrmInventoryManagement" Me!ItemCount = Me.RecordsetClone.RecordCount & " Items" MsgBox Me.RecordsetClone.RecordCount & " Items"
7
8530
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way of doing it. I have a table with products, tblProducts, some of them are Active while others are Inactive. The form shows all the products purchased by a customer, both Active and Inactive in a ComboBox, cbProducts. My client wants to view all...
0
1324
by: zfeld | last post by:
I have a ComboBox with the Simple DropDownStyle. when I select an item in the combobox list the SelectedIndexChanged Event and the SelectionChangeCommited Event are fired. When I type something into the ComboBox textfield it de-selects the current selection and any subsequent query of the comboBox's SelectedIndex property will reveal an index of -1 (nothing selected). However, there was neither a SelectedIndexChanged Event nor a...
5
9165
by: Eric A. Johnson | last post by:
Hi Everyone, I am at my wit's end here. I have a combobox (combyQueryTitle) that I need to use in order to select a query for my database project. Therefore, I am using the comboQueryTitle_SelectedIndexChanged handler to, when a new selection is made, update the query and refresh the display. The only problem is that the program seems to inexplicably start with the ..selectedindex property at -1! This makes no sense to me. ...
2
2522
by: jen | last post by:
i have select query that returns multiple records and populates a combobox/pulldown. once a selection from the pulldown is selected, i need to reference two or three fileds from the previous query related to that selection. as usual, i'm probably making this harder than it needs to be. any help is newbiously appreciated.
1
8063
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just a commandbutton on my form). The biggest problem I'm having is that I can't (don't know how) populate a combobox on static items such as "True, False, Any." The Any field, would be selected by the user to find all records where that fields is...
4
2689
by: Mtek | last post by:
Hi, We have a combo box on our page, which gets populated via a MySQL Query in PHP. What we want to do is to print the values on the page in a table that correspond the to selection from the combo box without a page refresh. I assume that I'll need to query ALL the needed values from the database and store them in an array This can be done in PHP. Drawing
9
5526
by: Greg (codepug | last post by:
I have a combobox with the RowSourceType set to Table/Query and the RowSource is an SQL query that references a separate lookup table that contains the data that can be selected in the combobox. Also, limittolist & autoexpand are set to Yes. Control source is set to the main table field where the data will go. I can highlight the data that was previously selected in the combobox, and press the delete key to remove it, but after I move...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
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...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10081
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
9946
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...
1
7494
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
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.