Aug 15, 2007 #1 hshaker Technical User Jun 29, 2007 66 CA Hi there, Is it possible for one report to be based on several queries? Suppose that you want to use the same report but want to filter the records based on what button the user clicks on? Thanks.
Hi there, Is it possible for one report to be based on several queries? Suppose that you want to use the same report but want to filter the records based on what button the user clicks on? Thanks.
Aug 15, 2007 #2 Remou Technical User Sep 30, 2002 13,030 BE Look at the arguments for OpenReport. The fourth is Where. Upvote 0 Downvote
Aug 15, 2007 Thread starter #3 hshaker Technical User Jun 29, 2007 66 CA Hi there, I do not know what is wrong with this "where clause" Private Sub cmdEWOByProcessStep_Click() On Error GoTo Err_cmdEWOByProcessStep_Click Dim stDocName As String stDocName = "rptEWOReport" DoCmd.OpenReport stDocName, acPreview, , (((tblEWO.ProcessStep) = [Forms]![frmEWOMenu]![cmbEWOProcessStep])) Exit_cmdEWOByProcessStep_Click: Exit Sub Err_cmdEWOByProcessStep_Click: MsgBox Err.Description Resume Exit_cmdEWOByProcessStep_Click Error says "Object required" Upvote 0 Downvote
Hi there, I do not know what is wrong with this "where clause" Private Sub cmdEWOByProcessStep_Click() On Error GoTo Err_cmdEWOByProcessStep_Click Dim stDocName As String stDocName = "rptEWOReport" DoCmd.OpenReport stDocName, acPreview, , (((tblEWO.ProcessStep) = [Forms]![frmEWOMenu]![cmbEWOProcessStep])) Exit_cmdEWOByProcessStep_Click: Exit Sub Err_cmdEWOByProcessStep_Click: MsgBox Err.Description Resume Exit_cmdEWOByProcessStep_Click Error says "Object required"
Aug 15, 2007 #4 Remou Technical User Sep 30, 2002 13,030 BE You need Where as a string: [tt]stDocName = "rptEWOReport" DoCmd.OpenReport stDocName, acPreview, , "ProcessStep = " &[Forms]![frmEWOMenu]![cmbEWOProcessStep][/tt] If ProcessStep is a text field, you will need single quotes: [tt]stDocName = "rptEWOReport" DoCmd.OpenReport stDocName, acPreview, , "ProcessStep = '" &[Forms]![frmEWOMenu]![cmbEWOProcessStep] & "'"[/tt] Upvote 0 Downvote
You need Where as a string: [tt]stDocName = "rptEWOReport" DoCmd.OpenReport stDocName, acPreview, , "ProcessStep = " &[Forms]![frmEWOMenu]![cmbEWOProcessStep][/tt] If ProcessStep is a text field, you will need single quotes: [tt]stDocName = "rptEWOReport" DoCmd.OpenReport stDocName, acPreview, , "ProcessStep = '" &[Forms]![frmEWOMenu]![cmbEWOProcessStep] & "'"[/tt]