Printining a Receipt

S

stuck! again!

Hi,
I have a report that is the receipt, however it puts every sale in the
report... i only want to have the current sale on it. each sale has a unique
number. please tell me exactly how i can make 1 receipt per page, as i am
quite the nooby when it comes to access.
 
S

stuck! again!

Thanks for your help, but now i get
Microsoft Access can't find the field 'RunID' referred to in your expression.
 
D

Duane Hookom

Whenever you see sample code like this, you can expect that you would
replace their variables and control names with yours. You stated "each sale
has a unique number". Replace RunID with the name of your unique number (and
your report name replaces "rptSomeReport".
 
S

stuck! again!

Hi,
thanks for your help but now i get, Microsoft access cant find field Sale#.
This is the original code:

Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere

This is how i have changed the code.

Dim strDocName As String
Dim strWhere As String
strDocName = "Receipt"
strWhere = "[Sale#]" & Me![sale#]
DoCmd.OpenReport strDocName, acPreview, , strWhere

Where did i go wrong? thank you very much
 
D

Duane Hookom

Do you have a control on your form named "Sale#"? Do you have a field in
your report's record source named "Sale#"?

You forgot the "=". If Sale# is numeric:
strWhere = "[Sale#]=" & Me![sale#]
If Sale# is text:
strWhere = "[Sale#]=""" & Me![sale#] & """"

I urge you to never use symbols like "#" in field names.

--
Duane Hookom
MS Access MVP


stuck! again! said:
Hi,
thanks for your help but now i get, Microsoft access cant find field
Sale#.
This is the original code:

Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere

This is how i have changed the code.

Dim strDocName As String
Dim strWhere As String
strDocName = "Receipt"
strWhere = "[Sale#]" & Me![sale#]
DoCmd.OpenReport strDocName, acPreview, , strWhere

Where did i go wrong? thank you very much
--
thanks alot


Duane Hookom said:
Whenever you see sample code like this, you can expect that you would
replace their variables and control names with yours. You stated "each
sale
has a unique number". Replace RunID with the name of your unique number
(and
your report name replaces "rptSomeReport".
 
S

stuck! again!

hi,
To answer question its yes to both. also i added the = but now it says
my expression has too many " )" but it dusnt have any.

--
thanks alot


Duane Hookom said:
Do you have a control on your form named "Sale#"? Do you have a field in
your report's record source named "Sale#"?

You forgot the "=". If Sale# is numeric:
strWhere = "[Sale#]=" & Me![sale#]
If Sale# is text:
strWhere = "[Sale#]=""" & Me![sale#] & """"

I urge you to never use symbols like "#" in field names.

--
Duane Hookom
MS Access MVP


stuck! again! said:
Hi,
thanks for your help but now i get, Microsoft access cant find field
Sale#.
This is the original code:

Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere

This is how i have changed the code.

Dim strDocName As String
Dim strWhere As String
strDocName = "Receipt"
strWhere = "[Sale#]" & Me![sale#]
DoCmd.OpenReport strDocName, acPreview, , strWhere

Where did i go wrong? thank you very much
--
thanks alot


Duane Hookom said:
Whenever you see sample code like this, you can expect that you would
replace their variables and control names with yours. You stated "each
sale
has a unique number". Replace RunID with the name of your unique number
(and
your report name replaces "rptSomeReport".

--
Duane Hookom
MS Access MVP


Thanks for your help, but now i get
Microsoft Access can't find the field 'RunID' referred to in your
expression.
--
thanks alot


:

Check the code at this page
http://www.mvps.org/access/reports/rpt0002.htm
"Print only the current record to a report".

--
Duane Hookom
MS Access MVP


message
Hi,
I have a report that is the receipt, however it puts every sale
in
the
report... i only want to have the current sale on it. each sale has
a
unique
number. please tell me exactly how i can make 1 receipt per page, as
i
am
quite the nooby when it comes to access.
 
D

Duane Hookom

Paste your new code into a reply.

--
Duane Hookom
MS Access MVP


stuck! again! said:
hi,
To answer question its yes to both. also i added the = but now it
says
my expression has too many " )" but it dusnt have any.

--
thanks alot


Duane Hookom said:
Do you have a control on your form named "Sale#"? Do you have a field in
your report's record source named "Sale#"?

You forgot the "=". If Sale# is numeric:
strWhere = "[Sale#]=" & Me![sale#]
If Sale# is text:
strWhere = "[Sale#]=""" & Me![sale#] & """"

I urge you to never use symbols like "#" in field names.

--
Duane Hookom
MS Access MVP


stuck! again! said:
Hi,
thanks for your help but now i get, Microsoft access cant find field
Sale#.
This is the original code:

Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere

This is how i have changed the code.

Dim strDocName As String
Dim strWhere As String
strDocName = "Receipt"
strWhere = "[Sale#]" & Me![sale#]
DoCmd.OpenReport strDocName, acPreview, , strWhere

Where did i go wrong? thank you very much
--
thanks alot


:

Whenever you see sample code like this, you can expect that you would
replace their variables and control names with yours. You stated "each
sale
has a unique number". Replace RunID with the name of your unique
number
(and
your report name replaces "rptSomeReport".

--
Duane Hookom
MS Access MVP


message
Thanks for your help, but now i get
Microsoft Access can't find the field 'RunID' referred to in your
expression.
--
thanks alot


:

Check the code at this page
http://www.mvps.org/access/reports/rpt0002.htm
"Print only the current record to a report".

--
Duane Hookom
MS Access MVP


message
Hi,
I have a report that is the receipt, however it puts every
sale
in
the
report... i only want to have the current sale on it. each sale
has
a
unique
number. please tell me exactly how i can make 1 receipt per page,
as
i
am
quite the nooby when it comes to access.
 
S

stuck! again!

Hi,

Here is what i have:

Private Sub Command33_Click()
Dim strDocName As String
Dim strWhere As String
strDocName = "Receipt"
strWhere = "[Sale#]=" & Me![Sale#]
DoCmd.OpenReport strDocName, acPreview, , strWhere
End Sub
 
D

Duane Hookom

Change the name of your control that is bound to Sale#. Name it "txtSaleNum"
and try this line:
strWhere = "[Sale#]=" & Me![txtSaleNum]
 
Top