I have a form and added a preview form button that is supposed to open the report using the current information entered in the current form.
The problem I'm having is that when I click on preview report it shows the first record in the table rather than the current record I just created, so i have to click on the next page until I get to the current record.
How do I set the preview report to show the preview of the current record opened in the form?
This is the code for the preview button:
Private Sub Previewreport_Click()
On Error GoTo Err_Previewreport_Click
Dim stDocName As String
stDocName = "Summary"
DoCmd.OpenReport stDocName, acPreview
Exit_Previewreport_Click:
Exit Sub
Err_Previewreport_Click:
MsgBox Err.Description
Resume Exit_Previewreport_Click
End Sub
Should I be saving this record before previewing it?
The problem I'm having is that when I click on preview report it shows the first record in the table rather than the current record I just created, so i have to click on the next page until I get to the current record.
How do I set the preview report to show the preview of the current record opened in the form?
This is the code for the preview button:
Private Sub Previewreport_Click()
On Error GoTo Err_Previewreport_Click
Dim stDocName As String
stDocName = "Summary"
DoCmd.OpenReport stDocName, acPreview
Exit_Previewreport_Click:
Exit Sub
Err_Previewreport_Click:
MsgBox Err.Description
Resume Exit_Previewreport_Click
End Sub
Should I be saving this record before previewing it?