Unanswered: How to Create Pop Up Before Report Preview to Enter Data
Currently I have a button my form that will open a report and populate with just the data from the currently shown record:
Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "CoC1", acViewPreview, , strWhere
I would like to open a form or pop-up beforehand that would allow me to type in quantities for some of the components that I have on the record previously. I would also like the items that I am entering the quantity for to be visible on this form for pop-up.
I have added a button to the main form with the following code that would call the form / popup with the information I would like to be able to enter before printing or running the report. Right now, I'm getting #Name? in the fields because it has no idea where the data is coming from - I need a way to pass the data from the current record to this form / popup. Like in my original button for running the report for the data current record.
Private Sub PrePrintForm_Click()
On Error GoTo Err_PrePrintForm_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PrePrint"
DoCmd.OpenForm stDocName, , , stLinkCriteria
I obviously don't need both buttons - I believe that I will need the second button that generates the popup - and then from there - there will be a button for generating the report preview. I just need a helping hand in how to pass data from the CURRENT record that I have displayed before I press the first button and then be able to enter data, and then pass that information on to the report.
It's difficult to explain by typing this out - so if anyone would like to help me with this - and would need more clarification please let me know.