Printing selected Record

  • Thread starter Thread starter Amanda
  • Start date Start date
A

Amanda

I'm new to access. I would like to put a command button to print a selected
record buy it asking me what record # do you want to print. I can't seem to
get this to work. Thank you in advance.
 
What do you mean by record number? There are no record numbers in Access.
If you mean the number you see in the box between the navigation buttons on
a form, those numbers just represent the ordinal position of the record
within the form's current recordset. They cannot be depended on. Any time
you filter a form, add a record, delete a record, or change the form's order,
the number will change. Normally, you would want to use some unique field in
the form's recordset to indentify a record. Then you can use the Where
argument of the OpenReport method to filter the report to that one record.
For example, say you have a customer form and the customer table has a
CustomerID primary key field, it would be:

Docmd.OpenReport "CustomerReport", , , "[CustomerID] = " &
Me.txtCustomerID
 
We use record # for the primary key field. Sorry

Klatuu said:
What do you mean by record number? There are no record numbers in Access.
If you mean the number you see in the box between the navigation buttons on
a form, those numbers just represent the ordinal position of the record
within the form's current recordset. They cannot be depended on. Any time
you filter a form, add a record, delete a record, or change the form's order,
the number will change. Normally, you would want to use some unique field in
the form's recordset to indentify a record. Then you can use the Where
argument of the OpenReport method to filter the report to that one record.
For example, say you have a customer form and the customer table has a
CustomerID primary key field, it would be:

Docmd.OpenReport "CustomerReport", , , "[CustomerID] = " &
Me.txtCustomerID

--
Dave Hargis, Microsoft Access MVP


Amanda said:
I'm new to access. I would like to put a command button to print a selected
record buy it asking me what record # do you want to print. I can't seem to
get this to work. Thank you in advance.
 
Okay.

Dim txtRecordNbr As txt

txtRecordNbr = InputBox("Enter Record # To Print")
If txtRecordNbr <> vbNullString Then
Docmd.OpenReport "CustomerReport", , , "[Record #] = " &
Clng(txtRecordNbr)
End If


--
Dave Hargis, Microsoft Access MVP


Amanda said:
We use record # for the primary key field. Sorry

Klatuu said:
What do you mean by record number? There are no record numbers in Access.
If you mean the number you see in the box between the navigation buttons on
a form, those numbers just represent the ordinal position of the record
within the form's current recordset. They cannot be depended on. Any time
you filter a form, add a record, delete a record, or change the form's order,
the number will change. Normally, you would want to use some unique field in
the form's recordset to indentify a record. Then you can use the Where
argument of the OpenReport method to filter the report to that one record.
For example, say you have a customer form and the customer table has a
CustomerID primary key field, it would be:

Docmd.OpenReport "CustomerReport", , , "[CustomerID] = " &
Me.txtCustomerID

--
Dave Hargis, Microsoft Access MVP


Amanda said:
I'm new to access. I would like to put a command button to print a selected
record buy it asking me what record # do you want to print. I can't seem to
get this to work. Thank you in advance.
 
Thank you I will try this. Have a great weekend!

Klatuu said:
Okay.

Dim txtRecordNbr As txt

txtRecordNbr = InputBox("Enter Record # To Print")
If txtRecordNbr <> vbNullString Then
Docmd.OpenReport "CustomerReport", , , "[Record #] = " &
Clng(txtRecordNbr)
End If


--
Dave Hargis, Microsoft Access MVP


Amanda said:
We use record # for the primary key field. Sorry

Klatuu said:
What do you mean by record number? There are no record numbers in Access.
If you mean the number you see in the box between the navigation buttons on
a form, those numbers just represent the ordinal position of the record
within the form's current recordset. They cannot be depended on. Any time
you filter a form, add a record, delete a record, or change the form's order,
the number will change. Normally, you would want to use some unique field in
the form's recordset to indentify a record. Then you can use the Where
argument of the OpenReport method to filter the report to that one record.
For example, say you have a customer form and the customer table has a
CustomerID primary key field, it would be:

Docmd.OpenReport "CustomerReport", , , "[CustomerID] = " &
Me.txtCustomerID

--
Dave Hargis, Microsoft Access MVP


:

I'm new to access. I would like to put a command button to print a selected
record buy it asking me what record # do you want to print. I can't seem to
get this to work. Thank you in advance.
 
Hi Amanda,

Heres one I have used for a while now.
http://allenbrowne.com/casu-15.html it wont ask which record you like to
print but it will print the record(s) you looking at, plus check to see if
is saved.
Richard


Amanda said:
Thank you I will try this. Have a great weekend!

Klatuu said:
Okay.

Dim txtRecordNbr As txt

txtRecordNbr = InputBox("Enter Record # To Print")
If txtRecordNbr <> vbNullString Then
Docmd.OpenReport "CustomerReport", , , "[Record #] = " &
Clng(txtRecordNbr)
End If


--
Dave Hargis, Microsoft Access MVP


Amanda said:
We use record # for the primary key field. Sorry

:

What do you mean by record number? There are no record numbers in Access.
If you mean the number you see in the box between the navigation buttons on
a form, those numbers just represent the ordinal position of the record
within the form's current recordset. They cannot be depended on. Any time
you filter a form, add a record, delete a record, or change the form's order,
the number will change. Normally, you would want to use some unique field in
the form's recordset to indentify a record. Then you can use the Where
argument of the OpenReport method to filter the report to that one record.
For example, say you have a customer form and the customer table has a
CustomerID primary key field, it would be:

Docmd.OpenReport "CustomerReport", , , "[CustomerID] = " &
Me.txtCustomerID

--
Dave Hargis, Microsoft Access MVP


:

I'm new to access. I would like to put a command button to print a selected
record buy it asking me what record # do you want to print. I can't seem to
get this to work. Thank you in advance.
 
I just tried that link, you may have to paste it directly into the address
bar sorry I didn't test that.

Richard said:
Hi Amanda,

Heres one I have used for a while now.
http://allenbrowne.com/casu-15.html it wont ask which record you like to
print but it will print the record(s) you looking at, plus check to see if
is saved.
Richard


Amanda said:
Thank you I will try this. Have a great weekend!

Klatuu said:
Okay.

Dim txtRecordNbr As txt

txtRecordNbr = InputBox("Enter Record # To Print")
If txtRecordNbr <> vbNullString Then
Docmd.OpenReport "CustomerReport", , , "[Record #] = " &
Clng(txtRecordNbr)
End If


--
Dave Hargis, Microsoft Access MVP


:

We use record # for the primary key field. Sorry

:

What do you mean by record number? There are no record numbers in Access.
If you mean the number you see in the box between the navigation buttons on
a form, those numbers just represent the ordinal position of the record
within the form's current recordset. They cannot be depended on. Any time
you filter a form, add a record, delete a record, or change the form's order,
the number will change. Normally, you would want to use some unique field in
the form's recordset to indentify a record. Then you can use the Where
argument of the OpenReport method to filter the report to that one record.
For example, say you have a customer form and the customer table has a
CustomerID primary key field, it would be:

Docmd.OpenReport "CustomerReport", , , "[CustomerID] = " &
Me.txtCustomerID

--
Dave Hargis, Microsoft Access MVP


:

I'm new to access. I would like to put a command button to print a selected
record buy it asking me what record # do you want to print. I can't seem to
get this to work. Thank you in advance.
 
Thank you very much for the help. I will try this too. Thank you!

Richard said:
I just tried that link, you may have to paste it directly into the address
bar sorry I didn't test that.

Richard said:
Hi Amanda,

Heres one I have used for a while now.
http://allenbrowne.com/casu-15.html it wont ask which record you like to
print but it will print the record(s) you looking at, plus check to see if
is saved.
Richard


Amanda said:
Thank you I will try this. Have a great weekend!

:

Okay.

Dim txtRecordNbr As txt

txtRecordNbr = InputBox("Enter Record # To Print")
If txtRecordNbr <> vbNullString Then
Docmd.OpenReport "CustomerReport", , , "[Record #] = " &
Clng(txtRecordNbr)
End If


--
Dave Hargis, Microsoft Access MVP


:

We use record # for the primary key field. Sorry

:

What do you mean by record number? There are no record numbers in Access.
If you mean the number you see in the box between the navigation buttons on
a form, those numbers just represent the ordinal position of the record
within the form's current recordset. They cannot be depended on. Any time
you filter a form, add a record, delete a record, or change the form's order,
the number will change. Normally, you would want to use some unique field in
the form's recordset to indentify a record. Then you can use the Where
argument of the OpenReport method to filter the report to that one record.
For example, say you have a customer form and the customer table has a
CustomerID primary key field, it would be:

Docmd.OpenReport "CustomerReport", , , "[CustomerID] = " &
Me.txtCustomerID

--
Dave Hargis, Microsoft Access MVP


:

I'm new to access. I would like to put a command button to print a selected
record buy it asking me what record # do you want to print. I can't seem to
get this to work. Thank you in advance.
 
Back
Top