A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Command button to Print/View Customer



 
 
Thread Tools Display Modes
  #1  
Old May 2nd, 2008, 11:39 PM posted to microsoft.public.access.forms
teelee
external usenet poster
 
Posts: 114
Default Command button to Print/View Customer

I have a form named Orders by Customer that has a subform with all the
customer's orders and I want to add a command button on the bottom so that
when an individual customer is showing along with all their information I can
print/view that info for that customer showing. Is there a way I can do this?


Thanks in Advance
  #2  
Old May 3rd, 2008, 01:26 AM posted to microsoft.public.access.forms
Damon Heron[_2_]
external usenet poster
 
Posts: 237
Default Command button to Print/View Customer

Design the report for Customer Orders using the report wizard. Then, add
your command button to the form and use the
openreport method to open for the customer that is current. See VB Help for
the openreport method use.

Damon


"teelee" wrote in message
...
I have a form named Orders by Customer that has a subform with all the
customer's orders and I want to add a command button on the bottom so that
when an individual customer is showing along with all their information I
can
print/view that info for that customer showing. Is there a way I can do
this?


Thanks in Advance



  #3  
Old May 3rd, 2008, 02:45 PM posted to microsoft.public.access.forms
teelee
external usenet poster
 
Posts: 114
Default Command button to Print/View Customer

I already have a report with customers orders and added the command button,
but when I click on it I get all the customers showing on the report. I only
need the customer that is showing in the subform.

Thanks

"Damon Heron" wrote:

Design the report for Customer Orders using the report wizard. Then, add
your command button to the form and use the
openreport method to open for the customer that is current. See VB Help for
the openreport method use.

Damon


"teelee" wrote in message
...
I have a form named Orders by Customer that has a subform with all the
customer's orders and I want to add a command button on the bottom so that
when an individual customer is showing along with all their information I
can
print/view that info for that customer showing. Is there a way I can do
this?


Thanks in Advance




  #4  
Old May 3rd, 2008, 06:14 PM posted to microsoft.public.access.forms
Damon Heron[_2_]
external usenet poster
 
Posts: 237
Default Command button to Print/View Customer

Okay, On the command button's properties, you will find the click event.
click on the (...) dots to go to the VB Editor. Add this code,
substituting your field and report names as needed..
Private Sub Command1_Click() ' your button may have a different name

DoCmd.OpenReport "Report1", acViewPreview, , "CustomerID= " & Text0,
acWindowNormal

'(in this case, the field Text0 holds the CustomerID on your form.
"CustomerID" is the name of the field in the table and on your 'report.)
This restricts the report to the customerID of your current form.

End Sub

Damon
"teelee" wrote in message
...
I already have a report with customers orders and added the command button,
but when I click on it I get all the customers showing on the report. I
only
need the customer that is showing in the subform.

Thanks

"Damon Heron" wrote:

Design the report for Customer Orders using the report wizard. Then, add
your command button to the form and use the
openreport method to open for the customer that is current. See VB Help
for
the openreport method use.

Damon


"teelee" wrote in message
...
I have a form named Orders by Customer that has a subform with all the
customer's orders and I want to add a command button on the bottom so
that
when an individual customer is showing along with all their information
I
can
print/view that info for that customer showing. Is there a way I can do
this?


Thanks in Advance






  #5  
Old May 4th, 2008, 11:43 PM posted to microsoft.public.access.forms
teelee
external usenet poster
 
Posts: 114
Default Command button to Print/View Customer

Ok this is what I have: Private Sub Preview_Report_Click()
DoCmd.OpenReport "Rpt Customer"
acViewPreview , , "CustomerID=" & Text0, acWindowNormal

End Sub
and this is the error message I'm getting: Compile error
Invalid use of Property
Any Suggestions of what I'm doing wrong?

Thanks

DoCmd.OpenReport "Rpt Customer"
acViewPreview , , "CustomerID=" & Text0, acWindowNormal

End Sub

"Damon Heron" wrote:

Okay, On the command button's properties, you will find the click event.
click on the (...) dots to go to the VB Editor. Add this code,
substituting your field and report names as needed..
Private Sub Command1_Click() ' your button may have a different name

DoCmd.OpenReport "Report1", acViewPreview, , "CustomerID= " & Text0,
acWindowNormal

'(in this case, the field Text0 holds the CustomerID on your form.
"CustomerID" is the name of the field in the table and on your 'report.)
This restricts the report to the customerID of your current form.

End Sub

Damon
"teelee" wrote in message
...
I already have a report with customers orders and added the command button,
but when I click on it I get all the customers showing on the report. I
only
need the customer that is showing in the subform.

Thanks

"Damon Heron" wrote:

Design the report for Customer Orders using the report wizard. Then, add
your command button to the form and use the
openreport method to open for the customer that is current. See VB Help
for
the openreport method use.

Damon


"teelee" wrote in message
...
I have a form named Orders by Customer that has a subform with all the
customer's orders and I want to add a command button on the bottom so
that
when an individual customer is showing along with all their information
I
can
print/view that info for that customer showing. Is there a way I can do
this?


Thanks in Advance






  #6  
Old May 5th, 2008, 12:54 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Command button to Print/View Customer

On Sun, 4 May 2008 15:43:00 -0700, teelee
wrote:

Ok this is what I have: Private Sub Preview_Report_Click()
DoCmd.OpenReport "Rpt Customer"
acViewPreview , , "CustomerID=" & Text0, acWindowNormal

End Sub
and this is the error message I'm getting: Compile error
Invalid use of Property
Any Suggestions of what I'm doing wrong?

Thanks

DoCmd.OpenReport "Rpt Customer"
acViewPreview , , "CustomerID=" & Text0, acWindowNormal


If you have a textbox named Text0 on the form, change Text0 in the above to

Me!Text0

That's a default name for a control, but it's a really bad name from a
usability and documentation standpoint; consider renaming the control and
using the new name in the Me! expression.
--

John W. Vinson [MVP]
  #7  
Old May 5th, 2008, 04:24 AM posted to microsoft.public.access.forms
Damon Heron[_2_]
external usenet poster
 
Posts: 237
Default Command button to Print/View Customer

As I said: "substituting your field and report names as needed"- do you
really have a "text0" textbox with the recordsource set to CustomerID?
If not, change the line to your textbox name. and take John's advice and
include the "me." although it will work without it.
Also, the line beginning "DoCmd." should all be on one line, hopefully that
is what you did, sometimes its hard to tell with News posts.

Damon

"teelee" wrote in message
...
Ok this is what I have: Private Sub Preview_Report_Click()
DoCmd.OpenReport "Rpt Customer"
acViewPreview , , "CustomerID=" & Text0, acWindowNormal

End Sub
and this is the error message I'm getting: Compile error
Invalid use of Property
Any Suggestions of what I'm doing wrong?

Thanks

DoCmd.OpenReport "Rpt Customer"
acViewPreview , , "CustomerID=" & Text0, acWindowNormal

End Sub

"Damon Heron" wrote:

Okay, On the command button's properties, you will find the click event.
click on the (...) dots to go to the VB Editor. Add this code,
substituting your field and report names as needed..
Private Sub Command1_Click() ' your button may have a different name

DoCmd.OpenReport "Report1", acViewPreview, , "CustomerID= " & Text0,
acWindowNormal

'(in this case, the field Text0 holds the CustomerID on your form.
"CustomerID" is the name of the field in the table and on your 'report.)
This restricts the report to the customerID of your current form.

End Sub

Damon
"teelee" wrote in message
...
I already have a report with customers orders and added the command
button,
but when I click on it I get all the customers showing on the report. I
only
need the customer that is showing in the subform.

Thanks

"Damon Heron" wrote:

Design the report for Customer Orders using the report wizard. Then,
add
your command button to the form and use the
openreport method to open for the customer that is current. See VB
Help
for
the openreport method use.

Damon


"teelee" wrote in message
...
I have a form named Orders by Customer that has a subform with all
the
customer's orders and I want to add a command button on the bottom
so
that
when an individual customer is showing along with all their
information
I
can
print/view that info for that customer showing. Is there a way I can
do
this?


Thanks in Advance








 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:04 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.