K
kevtrucker
I have a form with 6 pages on it, the form also has various command buttons,
one of these command buttons i want to print a report based on the current
record showing on the front page of the form.
The following is the code i have for the print report button.
Private Sub Command351_Click()
Dim strReportName As String
Dim strCriteria As String
If NewRecord Then
MsgBox "This record contains no data." _
, vbInformation, "Invalid Action"
Exit Sub
Else
strReportName = "inspection sheet-p"
strCriteria = "[regnumber]=" & Me!regnumber
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End If
End Sub
When i click on the button a message box appears asking for a parameter value,
the box also shows the value of the first field (regnumber) on the front page
of the form, when i enter the value into the box and press ok the report then
prints, i want this report to print automattically without the parameter
value box appearing.
The report is based on a simple query using 2 tables, one for vehicle details
and the other customer name and addresss, the main field that connects them
is vehicles.regnumber.
i have looked at other posts and can't find anything that covers my problem.
hopefully i have explained my problem clearly.
Thanks in advance for any assistance given.
Kevin
one of these command buttons i want to print a report based on the current
record showing on the front page of the form.
The following is the code i have for the print report button.
Private Sub Command351_Click()
Dim strReportName As String
Dim strCriteria As String
If NewRecord Then
MsgBox "This record contains no data." _
, vbInformation, "Invalid Action"
Exit Sub
Else
strReportName = "inspection sheet-p"
strCriteria = "[regnumber]=" & Me!regnumber
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End If
End Sub
When i click on the button a message box appears asking for a parameter value,
the box also shows the value of the first field (regnumber) on the front page
of the form, when i enter the value into the box and press ok the report then
prints, i want this report to print automattically without the parameter
value box appearing.
The report is based on a simple query using 2 tables, one for vehicle details
and the other customer name and addresss, the main field that connects them
is vehicles.regnumber.
i have looked at other posts and can't find anything that covers my problem.
hopefully i have explained my problem clearly.
Thanks in advance for any assistance given.
Kevin