Print Function in VBA

  • Thread starter Cipher via AccessMonster.com
  • Start date
C

Cipher via AccessMonster.com

Problem:
- I have a form generated from a CUSTOMER file containing many customers. I
have generated the form from the data for each customer and can PRINT the
form. As I have many customers, it would be nice to have a Control button on
the form that would generate a form for each customer in the list and then
print each form as it is generated. Doing it for each customer seperatly is
tedious.

Is there a Property (or Code) what can do this in VBA?
 
T

Tom van Stiphout

On Sat, 22 Nov 2008 15:03:26 GMT, "Cipher via AccessMonster.com"

You'll want to create a report to do that. The Report Wizard is a good
place to start.

-Tom.
Microsoft Access MVP
 
L

Linq Adams via AccessMonster.com

That's why the Access Gnomes created REPORTS!

You shouldn't be printing forms, you need to create a form to do what you
want. The simplest way to do this would be, from the Forms Tab in the Objects
Dialog box, hilite the form's name, right -click, select "Save As," modify
the name to whatever you want, then use the bottom dropdown box to select
"Report."

Now in Design View for the Report, format the report to display one record at
a time. Once you have it like you want it, place a button on your form to run
the Report. You can do this using the Command Button wizard.
 
C

Cipher via AccessMonster.com

Thanks
You'll want to create a report to do that. The Report Wizard is a good
place to start.

-Tom.
Microsoft Access MVP
Problem:
- I have a form generated from a CUSTOMER file containing many customers. I
[quoted text clipped - 5 lines]
Is there a Property (or Code) what can do this in VBA?
 
C

Cipher via AccessMonster.com

Linq:

I probably need to give you more information...sorry:
1) My Form named "Customer Report" is quite complex and generates calculated
fields from several tables. It is all done in VBA. The search information
(including the Customer Name) is from ComboBoxes.

2) I would like to ADD a feature that will allow the user to set all of the
"Search Information" EXCEPT the Customer. I have placed a PrintALLCustomers
button on the form. When this button is pressed I have another "Private Sub
PrintAllCustomers_Click()" that contains the necessary code to do all of the
calculations, this time starting at the FIRST CUSTOMER.

3) When all of this code is executed I would like to immediatly start
printing and then I will INDEX to the next record and start over. I would
like this to be totally automatic with NO prompts to the user and no
additional BUTTON PRESSING.

I have seen a function called: "RunCommand (acCmdPrint)" which almost works
but it requires the user to CLICK OK on the Printer Prompt. It would be
better if there was no User Prompting from Windows, otherwise the user will
have to stay there to keep pressing the PRINT button.

Problems:
1) When I investigated the Report Wizard it did not list my report, instead,
it just listed the Tables in my Database. To use the report wizard I would
have to generate another table from my Form, this looks like a lot of
unnessary work when it is easy to just print the Form even though the Gnomes
would not like it.

2) An answer to this next question would be very useful: I am using
Recordsets in the VBA. After I have executed:
Set rs = New ADODB.Recordset
StrOne = "SELECT * FROM Delivery_Data " & "WHERE ID=" & Record_Number
rs.Open StrOne, CurrentProject.Connection, adOpenForwardOnly,
adLockReadOnly
(where, Record_Number=1 so I can get the first record)

I would like to know the TOTAL number of records in the file Delivery_Data.
All attempts to use Count(), DCount or Count(*) have failed. Can you please
tell me the correct syntax to use.

I really appreciate all you help Linq...thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top