Print range of records

  • Thread starter Thread starter RD Wirr
  • Start date Start date
R

RD Wirr

I am trying to print a report containing a series of
records based on the recordID form the underlying table
that I have selected in a form. The recordID come from an
autonumber field that is selected in two comboboxes on
the form and I want to print all the records in the range
between the two selected recordIDs.

Can anyone tell me how to do this?

Thanks in advance,
RDW
 
I am trying to print a report containing a series of
records based on the recordID form the underlying table
that I have selected in a form. The recordID come from an
autonumber field that is selected in two comboboxes on
the form and I want to print all the records in the range
between the two selected recordIDs.

Can anyone tell me how to do this?

Thanks in advance,
RDW

Code the click event of a command button on your form:
DoCmd.OpenReport "ReportName", acViewPreview, ,"[RecordID] between " &
[Me!ComboFrom] & " and " & Me!ComboTo

The above assumes [RecordID] is a Number datatype, and that the
AutoNumber field is an Incremental, not Random number
 
Hi Fred,

It took me a while to come back to this. Thanks for the
suggestion but I'm having a problem with it. I have used
your code along with some that Access adds from the
Button Wizard and ended up with the following:

Private Sub PrintTagRange_Click()
On Error GoTo Err_PrintTagRange_Click

Dim stDocName As String

stDocName = "SerialNumTag"
DoCmd.OpenReport stDocName,
acViewPreview, , "[PieceID] between " & [Me!Combo56] & "
and " & Me!Combo58

Exit_PrintTagRange_Click:
Exit Sub

Err_PrintTagRange_Click:
MsgBox Err.Description
Resume Exit_PrintTagRange_Click

End Sub

The problem is I always get the following error message
when I try to run the command "Microsoft Access can't
find the field '|' referred to in your expression." I
can't seem to find any field named '|' in this code. Have
I got something wrong in the syntax here?
Thanks again,
RDW
-----Original Message-----


Code the click event of a command button on your form:
DoCmd.OpenReport "ReportName",
acViewPreview, ,"[RecordID] between " &
[Me!ComboFrom] & " and " & Me!ComboTo

The above assumes [RecordID] is a Number datatype, and that the
AutoNumber field is an Incremental, not Random number
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 
Hi Fred,

It took me a while to come back to this. Thanks for the
suggestion but I'm having a problem with it. I have used
your code along with some that Access adds from the
Button Wizard and ended up with the following:

Private Sub PrintTagRange_Click()
On Error GoTo Err_PrintTagRange_Click

Dim stDocName As String

stDocName = "SerialNumTag"
DoCmd.OpenReport stDocName,
acViewPreview, , "[PieceID] between " & [Me!Combo56] & "
and " & Me!Combo58

Exit_PrintTagRange_Click:
Exit Sub

Err_PrintTagRange_Click:
MsgBox Err.Description
Resume Exit_PrintTagRange_Click

End Sub

The problem is I always get the following error message
when I try to run the command "Microsoft Access can't
find the field '|' referred to in your expression." I
can't seem to find any field named '|' in this code. Have
I got something wrong in the syntax here?
Thanks again,
RDW
-----Original Message-----


Code the click event of a command button on your form:
DoCmd.OpenReport "ReportName",
acViewPreview, ,"[RecordID] between " &
[Me!ComboFrom] & " and " & Me!ComboTo

The above assumes [RecordID] is a Number datatype, and that the
AutoNumber field is an Incremental, not Random number
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.

My goof. Sorry.
Move the bracket in front of [ME!ComboFrom] to AFTER the ! ....
DoCmd.OpenReport "ReportName", acViewPreview, ,"[RecordID] between "
& Me![ComboFrom] & " and " & Me![ComboTo]

By placing the opening bracket in front of the Me!, Access was looking
for a control actually named Me!ComboFrom.
 
That worked like a charm Fred. Thanks very much for the
help
RDW
-----Original Message-----
Hi Fred,

It took me a while to come back to this. Thanks for the
suggestion but I'm having a problem with it. I have used
your code along with some that Access adds from the
Button Wizard and ended up with the following:

Private Sub PrintTagRange_Click()
On Error GoTo Err_PrintTagRange_Click

Dim stDocName As String

stDocName = "SerialNumTag"
DoCmd.OpenReport stDocName,
acViewPreview, , "[PieceID] between " & [Me!Combo56] & "
and " & Me!Combo58

Exit_PrintTagRange_Click:
Exit Sub

Err_PrintTagRange_Click:
MsgBox Err.Description
Resume Exit_PrintTagRange_Click

End Sub

The problem is I always get the following error message
when I try to run the command "Microsoft Access can't
find the field '|' referred to in your expression." I
can't seem to find any field named '|' in this code. Have
I got something wrong in the syntax here?
Thanks again,
RDW
-----Original Message-----
On Mon, 9 Feb 2004 22:21:04 -0800, RD Wirr wrote:

I am trying to print a report containing a series of
records based on the recordID form the underlying table
that I have selected in a form. The recordID come
from
an
autonumber field that is selected in two comboboxes on
the form and I want to print all the records in the range
between the two selected recordIDs.

Can anyone tell me how to do this?

Thanks in advance,
RDW

Code the click event of a command button on your form:
DoCmd.OpenReport "ReportName",
acViewPreview, ,"[RecordID] between " &
[Me!ComboFrom] & " and " & Me!ComboTo

The above assumes [RecordID] is a Number datatype, and that the
AutoNumber field is an Incremental, not Random number
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.

My goof. Sorry.
Move the bracket in front of [ME!ComboFrom] to AFTER the ! ....
DoCmd.OpenReport "ReportName",
acViewPreview, ,"[RecordID] between "
& Me![ComboFrom] & " and " & Me![ComboTo]

By placing the opening bracket in front of the Me!, Access was looking
for a control actually named Me!ComboFrom.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 
Back
Top