Open Report Based on Query

G

Guest

Change the way you open the report so you can open it from different forms
Use the WhereCriteria of the open report command line, living the
RecordSource without a criteria

Dim MyCriteria As Text
MyCriteria = "[FieldName] = " & Forms!frmCheckAction!TxtSalesID
Docmd.OpenReport "ReportName",,,MyCriteria

From the other form, set a different criteria, or open without a criteria

Docmd.OpenReport "ReportName"

Mybe this link will provide you with a different example

http://www.databasedev.co.uk/report_from_form_record.html
 
D

DS

I have a report based on a Query. In the Query's criteria On one field I
have this
=Forms!frmCheckAction!TxtSalesID
How do I open this report based on this query from a different form? Do I
leave the Query criteria blank? I'm getting confused!
Thanks
DS
 
G

Guest

I have tried this simple step and the report does not even open. Have spent
over an hour and nothing.

DoCmd.OpenReport "rptEmployeeDetails", acViewPreview, , _
"[lngEmpID]=Forms!frmEmployee

Ofer Cohen said:
Change the way you open the report so you can open it from different forms
Use the WhereCriteria of the open report command line, living the
RecordSource without a criteria

Dim MyCriteria As Text
MyCriteria = "[FieldName] = " & Forms!frmCheckAction!TxtSalesID
Docmd.OpenReport "ReportName",,,MyCriteria

From the other form, set a different criteria, or open without a criteria

Docmd.OpenReport "ReportName"

Mybe this link will provide you with a different example

http://www.databasedev.co.uk/report_from_form_record.html

--
Good Luck
BS"D


DS said:
I have a report based on a Query. In the Query's criteria On one field I
have this
=Forms!frmCheckAction!TxtSalesID
How do I open this report based on this query from a different form? Do I
leave the Query criteria blank? I'm getting confused!
Thanks
DS
 
G

Guest

The path to the feld in the form doesn't include the field name

DoCmd.OpenReport "rptEmployeeDetails", acViewPreview, , _
"[lngEmpID]=Forms!frmEmployee![FieldName]"

Have a look in the link I provided you with in your previous post

http://www.microsoft.com/office/com...ries&mid=b2c61e99-4d2c-469c-a68b-7bfeaa9d58e7

--
Good Luck
BS"D


TKM said:
I have tried this simple step and the report does not even open. Have spent
over an hour and nothing.

DoCmd.OpenReport "rptEmployeeDetails", acViewPreview, , _
"[lngEmpID]=Forms!frmEmployee

Ofer Cohen said:
Change the way you open the report so you can open it from different forms
Use the WhereCriteria of the open report command line, living the
RecordSource without a criteria

Dim MyCriteria As Text
MyCriteria = "[FieldName] = " & Forms!frmCheckAction!TxtSalesID
Docmd.OpenReport "ReportName",,,MyCriteria

From the other form, set a different criteria, or open without a criteria

Docmd.OpenReport "ReportName"

Mybe this link will provide you with a different example

http://www.databasedev.co.uk/report_from_form_record.html

--
Good Luck
BS"D


DS said:
I have a report based on a Query. In the Query's criteria On one field I
have this
=Forms!frmCheckAction!TxtSalesID
How do I open this report based on this query from a different form? Do I
leave the Query criteria blank? I'm getting confused!
Thanks
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top