Open Report Based on Query

  • Follow


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 


0
Reply DS 3/17/2007 8:55:03 PM

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" wrote:

> 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 
> 
> 
> 
0
Reply Utf 3/17/2007 8:50:15 PM


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" wrote:

> 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" wrote:
> 
> > 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 
> > 
> > 
> > 
0
Reply Utf 6/13/2007 10:27:00 PM

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/community/en-us/default.mspx?dg=microsoft.public.access.queries&mid=b2c61e99-4d2c-469c-a68b-7bfeaa9d58e7

-- 
Good Luck
BS"D


"TKM" wrote:

> 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" wrote:
> 
> > 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" wrote:
> > 
> > > 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 
> > > 
> > > 
> > > 
0
Reply Utf 6/13/2007 10:38:03 PM

3 Replies
383 Views

(page loaded in 0.049 seconds)


Reply: