M
Mountaineer
Hi,
I have a form called f_Requests based on a table. In the form header are
combo boxes and command boxes to do a search critieria of the data. This
works great. But now I want to print this record.
My primary key is called "RequestNumber" which is an autonumber and is on
the form.
To create the report, while the form was in design mode, I selected "Save
As" -Report. I saved the report as r_Requests. The only items I deleted
from the report were the command buttons (my primary key field
"RequestNumber" is on the report).
Back on my form I added a command button cmdPrint. I added the following
code to the Click event (from Allen Browne "Print the record in the form").
Private sub cmdPrint_Click()
Dim strWhere as string
If Me. Dirty Then
Me.Dirty = false
End If
If Me.NewRecord Then
msgbox "Select a record to Print"
Else
strWhere="[RequestNumber]=" & me.[RequestNumber]
Docmd.OpenReport "r_Request", acViewPreview, strWhere
End IF
End Sub
On the form, I do my search. I get record 1 of 1. I click the Print
command button and it brings up a "Enter Parameter Value" box for "Form". I
do not have a parameter query as a part of my form so I do not know what is
it asking or why. If I click ok (leaving the parameter box blank), the
report previews but it previews with all records not just the single record.
I've tried putting the cmdPrint button in the form header and design section
and got the same results. I'm lost.
Any help would be appreciated.
I have a form called f_Requests based on a table. In the form header are
combo boxes and command boxes to do a search critieria of the data. This
works great. But now I want to print this record.
My primary key is called "RequestNumber" which is an autonumber and is on
the form.
To create the report, while the form was in design mode, I selected "Save
As" -Report. I saved the report as r_Requests. The only items I deleted
from the report were the command buttons (my primary key field
"RequestNumber" is on the report).
Back on my form I added a command button cmdPrint. I added the following
code to the Click event (from Allen Browne "Print the record in the form").
Private sub cmdPrint_Click()
Dim strWhere as string
If Me. Dirty Then
Me.Dirty = false
End If
If Me.NewRecord Then
msgbox "Select a record to Print"
Else
strWhere="[RequestNumber]=" & me.[RequestNumber]
Docmd.OpenReport "r_Request", acViewPreview, strWhere
End IF
End Sub
On the form, I do my search. I get record 1 of 1. I click the Print
command button and it brings up a "Enter Parameter Value" box for "Form". I
do not have a parameter query as a part of my form so I do not know what is
it asking or why. If I click ok (leaving the parameter box blank), the
report previews but it previews with all records not just the single record.
I've tried putting the cmdPrint button in the form header and design section
and got the same results. I'm lost.
Any help would be appreciated.