473,320 Members | 2,052 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,320 software developers and data experts.

How do i link a control button to a combo box filter?

11
How can i link a control button to view a report based on the information selected in a combo box?

For example
I want to show all records for people with the name Steve.
I can select Steve from the combo box then i want to be able to press a preview button to view the filtered report for all records with the name Steve.

I dont like to use VBA so if anyone can explain using the macro builder that would be great!
Feb 16 '10 #1
10 7183
NDayave
92
Hi,

If you want to do this without VBA, follow these steps:

1) Name your combo box Eg. "cboName"
2) Make a query in design view selecting the fields you want from the table with the names stored
3) In the Name Criteria field, write "[Forms]![YourFormName].[cboName]"
4) Make a report with the Wizard based on the Query you just made
5) On the form, make a button and in the wizard select Report Operations -> Preview Report and select the report that you have just made.
6) Give the button a suitable name as well Eg. "cmdPreview"

That should do what you want to do,

NDayave
Feb 16 '10 #2
fairy56
11
Sorry i'm new to this!

Point 3 - In the Name Criteria field, write "[Forms]![YourFormName].[cboName]"

which section does this relate to? The combo box/ query?

Thank you for your help so far!
Feb 16 '10 #3
NDayave
92
When you have made your query, open it in design view. Where you have your Name field selected, should look something like

Field: Name
Table: YourTableName
Sort:
Show: Ticked
Criteria: <This is where you put [Forms]![YourFormName].[cboName]>

You need to substitute YourFormName for the name of the form that the combo box is on, and cboName for the name of the combo box.


What this does, is when your form is open and there is a selection in the combo box, it will take the selection and enter it into the query, only selecting the records from the table that match it.
If you want to test if it is working, open the form, select something in your combo box, then run the query and see if the results match the selection you have made in the combo box.
Feb 16 '10 #4
fairy56
11
Hi
Sorry i thought i'd cracked this but then the following error msg came up

'The Expression On Click you entered as the event property setting produced the following error: Ambiguous name detected: CorrectivePreview_Click.'

CorrectivePreview is the name of the button.

The query works on its own, and the combo is picking the results i need from the right table, i just cant get them to work together.

Any ideas?

Thanks!
Feb 17 '10 #5
NDayave
92
It looks like you have called your command button "CorrectivePreview_Click" somewhere. Are you sure you have entered "[Forms]![YourFormName].[CorrectivePreview]" exactly into the criteria section of the query?

If you have, open your form in design view, press ALT+F11 and paste everything you can see in the code window here so I can have a look at it.
Feb 17 '10 #6
fairy56
11
Hi

It's ok - I deleted all VB coding relating to the form and then re-did the button.

its works great now!! Thankyou for all your help!. Im sure i will come across another query again soon.

Many thanks!
Feb 18 '10 #7
NDayave
92
No problem, we all got to start out somewhere.

Glad you got it sorted :)
Feb 18 '10 #8
fairy56
11
Hi

Sorry another quick query.

I have built a report with a header in 'Report Header'. However although this shows in print preview it will only print when i print on high quality, if i try printing a fast draft it doesnt appear... is there anything i can do for this?

Thanks
Feb 19 '10 #9
NDayave
92
Personally I can't think of why it would be doing that, perhaps it is an issue with your printer?

Try Printing something in fast draft with text in the same place on the page as the report header to see if it is being cut off as part of the 'Fast Draft' page setup.

As for anything else, I am at a loss.
Feb 19 '10 #10
fairy56
11
It's ok - my colleague has the same problem, and the same printer so it must be something to do with that!

Thanks for all your help! im sure i will be asking again soon, probably monday lol!
Feb 19 '10 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
2
by: Stan | last post by:
I cannot make the link buttons fire ItemCommand from repeater control. Here is the code: <asp:repeater id=rptLetters runat="server"> <itemtemplate> <asp:linkbutton id="lnkLetter"...
8
by: simon | last post by:
On code behind file: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then Dim ctrl As New LinkButton ctrl.ID =...
4
by: Miguel Dias Moura | last post by:
Hello, I created a datalist in an ASP.Net / VB page. I display the image and price of a few products. When a user clicks an image I want to load the page "detail.aspx?number=id" and send the...
2
by: Fred Flintstone | last post by:
I'm creating a multi-column dropdown since there isn't one. My idea is to override an Infragistics Combo and add the dropdown as a grid object. So I create a basic override of the control. The...
4
by: kschneider | last post by:
Assume there's a form with it's action attribute all set to post to a URL, but without a submit control. Form submission is done via a link and I want to prevent the classic "double submit"....
14
by: mchlle | last post by:
How can I filter records of a subform that is part of a tab control? The filter works fine on the form when it is not part of the tab using this in the macro condition: !!="Today" I have a main...
1
by: MLH | last post by:
I have a form with a subform control on it listing records returned by a saved query named UnbilledVehicles. I would like to put command buttons on the main form to apply dynamic filters to the...
3
by: WiscCard | last post by:
This seems simple enough, but I am having problems. I have a table of customer information. I have a form with various combo boxes displaying unique customer information (in this case, zone and...
2
by: Dhruvit | last post by:
I am tring to piggy back on this code, but needed some help. I have a combo box, and I've defined an "Add" Command button. So once a selection is updated from the combo, the "Add" button needs to be...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.