Need to generate a report based on the value of a combo box

S

Sam

Hello everyone....

I am trying to generate a report based on a combox box. I need the report to
show only those records that have an entry in the combo box titled "Override
Code"

I have set up a Query with the following fields:- Application ID, Status,
DateApproved, Override Code, Override Authorised by.

Can this be done???
 
A

Allan Murphy

Sam

In the criteria of your Override Code put the following [forms]![your form
name]![override code] where override code is the name of your combo box.
 
K

Klatuu

I don't think I would do it there. I would use the reports filter property
and reference the combo box on the form.
[forms]![yourformname]![override code]

Allan Murphy said:
Sam

In the criteria of your Override Code put the following [forms]![your form
name]![override code] where override code is the name of your combo box.

--
Allan Murphy
Email: [email protected]


Sam said:
Hello everyone....

I am trying to generate a report based on a combox box. I need the report to
show only those records that have an entry in the combo box titled "Override
Code"

I have set up a Query with the following fields:- Application ID, Status,
DateApproved, Override Code, Override Authorised by.

Can this be done???
 
M

Marshall Barton

Sam said:
I am trying to generate a report based on a combox box. I need the report to
show only those records that have an entry in the combo box titled "Override
Code"

I have set up a Query with the following fields:- Application ID, Status,
DateApproved, Override Code, Override Authorised by.


I recommend a third way by using the OpenReport method's
WhereCondition argument. Use the Click event procedure of a
button on your form. Change the wizard generated procedure
to be like:

Dim strDoc As String
Dim strWhere As String
strDoc = "name of report"
strWhere = "[Override Code]=" & Me.[Override Code]
DoCmd.OpenReport strDoc, , , strWhere

If the field [Override Code] is a Text type field, then use
this line in place of the one above:

strWhere = "[Override Code]=""" & Me.[Override Code] & """"
 
K

Klatuu

That is even better. Interesting how many different ways there are to do the
same thing.

Marshall Barton said:
Sam said:
I am trying to generate a report based on a combox box. I need the report to
show only those records that have an entry in the combo box titled "Override
Code"

I have set up a Query with the following fields:- Application ID, Status,
DateApproved, Override Code, Override Authorised by.


I recommend a third way by using the OpenReport method's
WhereCondition argument. Use the Click event procedure of a
button on your form. Change the wizard generated procedure
to be like:

Dim strDoc As String
Dim strWhere As String
strDoc = "name of report"
strWhere = "[Override Code]=" & Me.[Override Code]
DoCmd.OpenReport strDoc, , , strWhere

If the field [Override Code] is a Text type field, then use
this line in place of the one above:

strWhere = "[Override Code]=""" & Me.[Override Code] & """"
 
Top