I have a form (frm-ParentMainForm), with a subform (frm-ChildPLHours) holding a label (Label9).
I would like to click on Label9, which would open a report in print preview. The report is based on a query (QRY-ProjectHrsSearch) which has a parameter asking for "What project number would you like?" When Label9 is clicked I want it to match the Project# that is in the current record in frm-ParentMainForm with the Project# as the parameter. Below is the code I wrote:
DoCmd.OpenReport "RPT-ProjectHrsSearch", acViewPreview, , [QRY-ProjectHrsSearch].[Project#] = [frm-ParentProjectMain].[Project#]
However, I am getting an error because it does not like one of my names. They are all right, but I am sure my syntax is wrong. Any suggestions? Thanks, JL
I would like to click on Label9, which would open a report in print preview. The report is based on a query (QRY-ProjectHrsSearch) which has a parameter asking for "What project number would you like?" When Label9 is clicked I want it to match the Project# that is in the current record in frm-ParentMainForm with the Project# as the parameter. Below is the code I wrote:
DoCmd.OpenReport "RPT-ProjectHrsSearch", acViewPreview, , [QRY-ProjectHrsSearch].[Project#] = [frm-ParentProjectMain].[Project#]
However, I am getting an error because it does not like one of my names. They are all right, but I am sure my syntax is wrong. Any suggestions? Thanks, JL