Dear Friends?
I feel plain stupid but I can't figure out to get my form to print a
single record that is based off of my report. I am using Access
2003. Needless to say, I'm up against a deadline here and beyond
frustrated. My table is called Advance2. My Form is called Onsite
Form and my Report is called rptPrintRecord. Can you help?
Jeff
|
|
0
|
|
|
|
Reply
|
LATorders
|
4/22/2007 3:32:37 AM |
|
On 21 Apr 2007 20:32:37 -0700, LATorders@gmail.com wrote:
> Dear Friends?
>
> I feel plain stupid but I can't figure out to get my form to print a
> single record that is based off of my report. I am using Access
> 2003. Needless to say, I'm up against a deadline here and beyond
> frustrated. My table is called Advance2. My Form is called Onsite
> Form and my Report is called rptPrintRecord. Can you help?
>
> Jeff
Your table should have a unique prime key field.
In my example it is named [RecordID].
On the command button's property sheet write
[Event Procedure]
on the Click event line.
Then click on the little button with 3 dots that will appear on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines write:
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport " rptPrintRecord", acViewPreview, , "[RecordID] = " &
[RecordID]
The above assumes a [RecordID] field that is a Number Datatype.
If, however, [RecordID] is Text Datatype, then use:
DoCmd.OpenReport " rptPrintRecord", acViewPreview, ,"[RecordID] = '" &
[RecordID] & "'"
as the Where clause.
For clarity, the single and double quotes are..
"[RecordID] = ' " & [RecordID] & " ' "
Change [RecordID] to whatever the actual field name is that you are
using.
See VBA Help files for:
Where Clause + Restrict data to a subset of records'
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
|
|
0
|
|
|
|
Reply
|
fredg
|
4/22/2007 3:49:17 AM
|
|