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_click()
DoCmd.DoMenuItem 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_click()
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
textbox.setfocus
textbox.text = "change text1"
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
textbox.setfocus
textbox.text = "change text2"
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
end sub
I do keep getting error "SelectRecord" 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 5 2417
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_click() DoCmd.DoMenuItem 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_click() DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection
textbox.setfocus textbox.text = "change text1" DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection
textbox.setfocus textbox.text = "change text2" DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection end sub
I do keep getting error "SelectRecord" 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.
"Deano" <de*********@hotmail.com> wrote in message news:<41***********************@ptn-nntp-reader03.plus.net>... 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_click() DoCmd.DoMenuItem 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_click() DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection
textbox.setfocus textbox.text = "change text1" DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection
textbox.setfocus textbox.text = "change text2" DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection end sub
I do keep getting error "SelectRecord" 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
Darren DeCoste wrote: "Deano" <de*********@hotmail.com> wrote in message news:<41***********************@ptn-nntp-reader03.plus.net>... 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_click() DoCmd.DoMenuItem 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_click() DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection
textbox.setfocus textbox.text = "change text1" DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection
textbox.setfocus textbox.text = "change text2" DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection end sub
I do keep getting error "SelectRecord" 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. dd******@yahoo.com (Darren DeCoste) wrote in message news:<73**************************@posting.google. com>... "Deano" <de*********@hotmail.com> wrote in message news:<41***********************@ptn-nntp-reader03.plus.net>... 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_click() DoCmd.DoMenuItem 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_click() DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection
textbox.setfocus textbox.text = "change text1" DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection
textbox.setfocus textbox.text = "change text2" DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection end sub
I do keep getting error "SelectRecord" 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.SetFocus
copytype.Text = "FILE"
copytype.ForeColor = 16744448
Form.SetFocus
Call PrintOne_Click ' Prints form with changed field both text and
color
copytype.SetFocus
copytype.Text = "ACCOUNTING/REP"
copytype.ForeColor = 32768
Form.SetFocus
Call PrintOne_Click ' Prints form with changed field both text and
color
copytype.SetFocus
copytype.Text = "ORIGINAL"
copytype.ForeColor = 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 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 :) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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
|
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...
|
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...
|
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
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |