473,569 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Print with changed copies

I have an access project with a Form that has a Command button to
print the current record. I would like to Print the record 3 times,
changing a text field on each print.

The standard code of
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
End sub
Works good for one copy.

I would like to do something like this:
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text1"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text2"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
end sub

I do keep getting error "SelectReco rd" command isn't available.

Do I have to set focus back to the form??

Any ideas on how this can be done. Thank you for all your help.

Darren
Nov 13 '05 #1
5 2430
Darren DeCoste wrote:
I have an access project with a Form that has a Command button to
print the current record. I would like to Print the record 3 times,
changing a text field on each print.

The standard code of
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
End sub
Works good for one copy.

I would like to do something like this:
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text1"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text2"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
end sub

I do keep getting error "SelectReco rd" command isn't available.

Do I have to set focus back to the form??

Any ideas on how this can be done. Thank you for all your help.

Darren


I'm not sure that you have to set focus back to the form. I haven't tried
anything like this but as long as you can refer to the textbox you can
change it's value. Take out the setfocus lines and see what happens.

Nov 13 '05 #2
"Deano" <de*********@ho tmail.com> wrote in message news:<41******* *************** *@ptn-nntp-reader03.plus.n et>...
Darren DeCoste wrote:
I have an access project with a Form that has a Command button to
print the current record. I would like to Print the record 3 times,
changing a text field on each print.

The standard code of
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
End sub
Works good for one copy.

I would like to do something like this:
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text1"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text2"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
end sub

I do keep getting error "SelectReco rd" command isn't available.

Do I have to set focus back to the form??

Any ideas on how this can be done. Thank you for all your help.

Darren


I'm not sure that you have to set focus back to the form. I haven't tried
anything like this but as long as you can refer to the textbox you can
change it's value. Take out the setfocus lines and see what happens.

I originally did not have the setfocus and I would get an error
telling me that I could not change the textbox properties since it did
not have the focus. That is the main reason I used the setfocus
command. I would prefer not having to set the focus but I thought
that it was neccessary.

Thank you
Darren
Nov 13 '05 #3
Darren DeCoste wrote:
"Deano" <de*********@ho tmail.com> wrote in message
news:<41******* *************** *@ptn-nntp-reader03.plus.n et>...
Darren DeCoste wrote:
I have an access project with a Form that has a Command button to
print the current record. I would like to Print the record 3 times,
changing a text field on each print.

The standard code of
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
End sub
Works good for one copy.

I would like to do something like this:
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text1"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text2"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
end sub

I do keep getting error "SelectReco rd" command isn't available.

Do I have to set focus back to the form??

Any ideas on how this can be done. Thank you for all your help.

Darren


I'm not sure that you have to set focus back to the form. I haven't
tried anything like this but as long as you can refer to the textbox
you can change it's value. Take out the setfocus lines and see what
happens.

I originally did not have the setfocus and I would get an error
telling me that I could not change the textbox properties since it did
not have the focus. That is the main reason I used the setfocus
command. I would prefer not having to set the focus but I thought
that it was neccessary.

Thank you
Darren


There's probably an issue with opening a report and referring to an open
form. If I was doing this I would probably just modify the recordsource
each time and then print.

Nov 13 '05 #4
dd******@yahoo. com (Darren DeCoste) wrote in message news:<73******* *************** ****@posting.go ogle.com>...
"Deano" <de*********@ho tmail.com> wrote in message news:<41******* *************** *@ptn-nntp-reader03.plus.n et>...
Darren DeCoste wrote:
I have an access project with a Form that has a Command button to
print the current record. I would like to Print the record 3 times,
changing a text field on each print.

The standard code of
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
End sub
Works good for one copy.

I would like to do something like this:
private sub printbutton_cli ck()
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text1"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

textbox.setfocu s
textbox.text = "change text2"
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
end sub

I do keep getting error "SelectReco rd" command isn't available.

Do I have to set focus back to the form??

Any ideas on how this can be done. Thank you for all your help.

Darren


I'm not sure that you have to set focus back to the form. I haven't tried
anything like this but as long as you can refer to the textbox you can
change it's value. Take out the setfocus lines and see what happens.

I originally did not have the setfocus and I would get an error
telling me that I could not change the textbox properties since it did
not have the focus. That is the main reason I used the setfocus
command. I would prefer not having to set the focus but I thought
that it was neccessary.

Thank you
Darren


Deano, Thank you for your help.

I figured out the problem today.

I actually created one sub for the printing and the other sub tied to
the button. The one tied to the button called the one that did the
printing 3 seperate times. I also had to give the Form the focus
after updating the data. I ended up doing this:

One sub with the standard Form Print commands (PrintOne_Click ) and the
other as: below

Call PrintOne_Click 'Prints the original

copytype.SetFoc us
copytype.Text = "FILE"
copytype.ForeCo lor = 16744448
Form.SetFocus
Call PrintOne_Click ' Prints form with changed field both text and
color

copytype.SetFoc us
copytype.Text = "ACCOUNTING/REP"
copytype.ForeCo lor = 32768
Form.SetFocus
Call PrintOne_Click ' Prints form with changed field both text and
color

copytype.SetFoc us
copytype.Text = "ORIGINAL"
copytype.ForeCo lor = 255
Form.SetFocus ' Places the data back into the original state

This gives me 3 copies of the form with differnent labels for each
form.
It may not be the best coding technique but it gets the job done.
Thank you for the help

Darren
Nov 13 '05 #5
Deano, Thank you for your help.

I figured out the problem today.
<snipped>
This gives me 3 copies of the form with differnent labels for each
form.
It may not be the best coding technique but it gets the job done.
Thank you for the help


I know what you mean; you should see some of my coding :)
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4284
by: David Allison | last post by:
cmdButton to Print 3 copies of record in Form view ? cmdButton will print 1 but I need 3 copies of the one Form record. -- Dave Allison
8
3942
by: Hank Reed | last post by:
Hello, I have searched through dozens of old responses to this question but have been unable to make it work in my situation. I'm using Access 2000 We have a very old sticker printer on a serial line. Neither situation is going to be upgraded so don't suggest that. A simple sticker report takes 10 seconds to reach the printer. That is...
25
10183
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab...
1
8433
by: ekey | last post by:
Hi follow function to print many copies but it only print one copy, my document is only one page; but i want to print many copies .such as three copies. how to do? Where do it error? THS private void mn_file_print_Click(object sender, System.EventArgs e) { PrintDialog dlg = new PrintDialog();
3
1714
by: Ann Huxtable | last post by:
I wrote a method that accepted a form. The signature was as ff: void foo(ref Form frm) ; I had to remove the ref keyword to get it to compile. Any idea why? I though forms would be passed by reference. I certainly dont want copies of my form to be made before being passed as some of the forms are quite "heavy". Look forward to some...
5
3920
by: ortaias | last post by:
I have a form which calls up a second form for purposes of data entry. When closing the data entry form and returning to the main form, things don't work as expected. When I return to the main form, I trigger the on acitvate event to run a macro. I can use the Dlookup function to update my fields, which is OK. However, I intitially tried...
4
1874
by: Adam - Regus | last post by:
I'm trying to create a button that prints 2 copies of a form. Using the wizard, I created a button that prints one automatically, using the following code: End Sub Private Sub CSR_BeforeUpdate(Cancel As Integer) End Sub Private Sub PRINTFORM_Click()
1
1580
by: ahafeez | last post by:
Hi readers I have an application in MS Access 2003 and having 2 forms i.e. Quotation & Invoice and I created their reports in crystal report and convert these reports in EXE files now i wanted to run these reports through form Print button. i mean to say if user enter any quotation or invoice then he will press print button and specific...
2
2455
by: chuck gregory | last post by:
I am using a microsoft access 2002 (10.6771.6845) SP3 program and recently linked new table to one I have been using a long time, with a one (new table) to many (old table) relationship, which worked fine when I created 22 forms linked to the original table and form. However, I wanted to have the pirmary key numbers posted in both tables at...
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.