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

Help with opening a report with only the selections

19
I need help with opening a report when a button is clicked, but I only want to open the report with the Object I have chosen in the combo box. This is what i have so far:

'If 2 is selected open the report with onlythe selected Vehicles'
ElseIf fraLabelTypeSelection = 2 Then
DoCmd.OpenReport "rptLabels", acViewPreview, , VehicleMake = Forms!frmLabelSelection!cboVehicle Else
MsgBox "Please make a Selection"
End If
End Sub

Report name = rptLabels
combo box where selections are made = cboVehicle
Form the combo box and option buttons are in = frmLabelSelection
i think the bold line is where I am going wrong - have I set it up incorrectly?
Nov 21 '06 #1
3 1481
MMcCarthy
14,534 Expert Mod 8TB
I need help with opening a report when a button is clicked, but I only want to open the report with the Object I have chosen in the combo box. This is what i have so far:

'If 2 is selected open the report with onlythe selected Vehicles'
ElseIf fraLabelTypeSelection = 2 Then
DoCmd.OpenReport "rptLabels", acViewPreview, , VehicleMake = Forms!frmLabelSelection!cboVehicle Else
MsgBox "Please make a Selection"
End If
End Sub

Report name = rptLabels
combo box where selections are made = cboVehicle
Form the combo box and option buttons are in = frmLabelSelection
i think the bold line is where I am going wrong - have I set it up incorrectly?
Hi Ducky

You haven't made a bad start, essentially in the criteria you have to put the field= in quotes and then & to join the value in the combobox to the statement. I've also surrounded the combobox value with single quotes because I'm assuming its text.

Expand|Select|Wrap|Line Numbers
  1.  
  2.   'If 2 is selected open the report with onlythe selected Vehicles'
  3.   ElseIf fraLabelTypeSelection = 2 Then
  4.     DoCmd.OpenReport "rptLabels", acViewPreview, , "[VehicleMake]='" & Forms!frmLabelSelection!cboVehicle & "'"
  5.   Else
  6.     MsgBox "Please make a Selection"
  7.   End If
  8. End Sub
  9.  
Mary
Nov 22 '06 #2
ducky
19
I have followed your instructions and it sort of works, I can select the item in the cobobox but when I click the PreviewLabel button, it opens the report with error in it. I think I might have mixed up my fields or forms but I don't know where I went wrong.
Nov 22 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
I have followed your instructions and it sort of works, I can select the item in the cobobox but when I click the PreviewLabel button, it opens the report with error in it. I think I might have mixed up my fields or forms but I don't know where I went wrong.
What is the SQL of the query behind the report?
Nov 22 '06 #4

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

Similar topics

5
by: Steve Patrick | last post by:
Hi All You guys are my last hope, despite spending money on books and hours reading them I still can not achieve the results I need. I have designed a database in Access 2000 based on 1 table,...
4
by: Alan Lane | last post by:
Hello world: I'm including both code and examples of query output. I appologize if that makes this message longer than it should be. Anyway, I need to change the query below into a pivot table...
2
by: Craig B. | last post by:
I am relativly new to access 2000 and am having some trouble with a report. I am not sure what I want to do is something I can do in access. I want to be able to choose from a combo box multiple...
1
by: prabhukalyan | last post by:
Hi all, I am not so good in queries. here is my problem 2 tables to store the received items (fabric)-- inwardmaster, inwarddetails and after some processing (Dyeing) the items were...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
6
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as...
5
by: Debbiedo | last post by:
I am wondering if I can create an application that when you click on it (say a shortcut), it opens a report parameter box to query a set of parameters, and then opens the report based on these...
3
by: Paul H | last post by:
I have a transactions table and a balance table that look something like this: tblTransactions TransactionID (PK Autonumber) ClientID TransactionDate TransactionAmount (currency field, values...
12
by: micarl | last post by:
How would i print a report based on criteria selected from several Combo Boxes as well as multiple Multi Select List Boxes, that are located on the same form? I can get one Multi List Box, just...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.