I searched online for some similar issues that I am facing but was not able come up with anything. I am fairly new with Access (2 months experience) and I am trying to remove a message stating, ENTER PARAMETER VALUE when I am generating a report. I know that the culprit lies in the query stored in the report. I have entered data in the CRITERIA (entered forms!frmproducts!lngproductID) window and OR (entered forms!frmproduser!lngproductID) window. The problem is that if one is filled with a value, the other one asks for a value through an ENTER PARAMETER VALUE window.
I would like to avoid using two reports (one for each form) to solve the problem by only have one criteria filled in each report query.
There are two ways I could think of to solve the problem:
First way: using VB to detect and automatically fill in a value of '0' (zero) when the form frmproducts is closed on the same computer.
I have two forms that print to the exact same report:
1) forms!frmproducts!lngproductID - for administrator
2) forms!frmproduser!lngproductID - for product manager (limited data changes and access).
Below is the current VB code from print command button on the form, FRMPRODUSER.
*** BEGIN VB CODE *****
Expand|Select|Wrap|Line Numbers
- Private Sub Preview_Click()
- On Error GoTo Err_Preview_Click
- DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
- If IsNull(Me![LngProductID]) Then
- MsgBox "Please enter the product data in the form."
- Else
- MsgBox "Opening default label, 4x3, to preview for printing."
- DoCmd.OpenReport "rpt4x3StdLabel", acPreview, , "Forms![frmProdUser].[lngProductID]=" & Me![lngProductID]
- End If
- Exit_Preview_Click:
- Exit Sub
- Err_Preview_Click:
- If Err <> 2501 Then
- MsgBox Err.DESCRIPTION
- End If
- Resume Exit_Preview_Click
- End Sub
Secondly, is there a function that would be satisfied if only one form forwards the data via VB? I would be entering the parameters in teh CRITERIA box in the report query.
I hope that I am making sense. If not, feel free to clarify. I am self-taught on Access (by way of books and reading online), so I am not quite familiar with the common terms you all use.
Any help would be greatly appreciated.
-Eric