blackduck603
Registered User.
- Local time
- Today, 01:49
- Joined
- Dec 27, 2007
- Messages
- 16
In Access 2000, I have created a report that uses a Query as the RecordSource.
rptMyReport
RecordSource: qryInventoryDetailsDivisionParam
The Query requires one parameter which it gets from a form.
SELECT [InventoryItems].[InvCtrlNum], [InventoryItems].[ItemDesc], [InventoryItems].[PurchaseDate], [InventoryItems].[PurchasePrice], [PO], [SN], [InventoryItems].[StatusDesc], [LocationName], [DivisionName]
FROM InventoryItems
WHERE [InventoryItems].[DivisionName]=[Forms]![GetDivisionParamForm]![DivisionCombo];
I'v got everything tied together so that when I launch the report, the form gets launched to prompt for the required parameter and then the query executes. The report gets displayed with the correct data
BUT
the query results are also displayed.
I just tried adding code to Close the query, but it sure isn't graceful. The user can see the Query results open and then close before the report is displayed.
Here is my Form's code:
-------------------------------------------------------------------------
Option Compare Database
Private Sub Cancel_Click()
DoCmd.Close 'Close Form
End Sub
Private Sub OK_Click()
Me.Visible = False
DoCmd.OpenQuery "qryInventoryDetailsDivisionParam", acViewNormal, acEdit
'***************************************************
' This closes the Query output, but it ain't pretty
DoCmd.Close acQuery, "qryInventoryDetailsDivisionParam"
'***************************************************
End Sub
Private Sub Form_Open(Cancel As Integer)
If Not bInReportOpenEvent Then
' If we're not called from the report
MsgBox "For use from the Inventory Detail Rpt for Specific Division only", _
vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
-------------------------------------------------------------------------
Does anyone know if there is a way to entirely suppress the query?
Seems like there should be a way to do this.......If I have a Query-Based report that requires no parameters, the report gets displayed without the query results popping up. I guess the part that is throwing me is when I have to use a Form to get a parameter for a query behind a report.
I appreciate any comments, suggestions, etc.
rptMyReport
RecordSource: qryInventoryDetailsDivisionParam
The Query requires one parameter which it gets from a form.
SELECT [InventoryItems].[InvCtrlNum], [InventoryItems].[ItemDesc], [InventoryItems].[PurchaseDate], [InventoryItems].[PurchasePrice], [PO], [SN], [InventoryItems].[StatusDesc], [LocationName], [DivisionName]
FROM InventoryItems
WHERE [InventoryItems].[DivisionName]=[Forms]![GetDivisionParamForm]![DivisionCombo];
I'v got everything tied together so that when I launch the report, the form gets launched to prompt for the required parameter and then the query executes. The report gets displayed with the correct data
BUT
the query results are also displayed.
I just tried adding code to Close the query, but it sure isn't graceful. The user can see the Query results open and then close before the report is displayed.
Here is my Form's code:
-------------------------------------------------------------------------
Option Compare Database
Private Sub Cancel_Click()
DoCmd.Close 'Close Form
End Sub
Private Sub OK_Click()
Me.Visible = False
DoCmd.OpenQuery "qryInventoryDetailsDivisionParam", acViewNormal, acEdit
'***************************************************
' This closes the Query output, but it ain't pretty
DoCmd.Close acQuery, "qryInventoryDetailsDivisionParam"
'***************************************************
End Sub
Private Sub Form_Open(Cancel As Integer)
If Not bInReportOpenEvent Then
' If we're not called from the report
MsgBox "For use from the Inventory Detail Rpt for Specific Division only", _
vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
-------------------------------------------------------------------------
Does anyone know if there is a way to entirely suppress the query?
Seems like there should be a way to do this.......If I have a Query-Based report that requires no parameters, the report gets displayed without the query results popping up. I guess the part that is throwing me is when I have to use a Form to get a parameter for a query behind a report.
I appreciate any comments, suggestions, etc.