Print current from in report style???

crann

Registered User.
Local time
Today, 23:04
Joined
Nov 23, 2002
Messages
160
Hi Guys,

I think i am missing something simple here.

I have a form, and a report that presents the data from the form in an invoice type style.

I have inserted a print button on the form that prints the report, but it prints all the reports that i have in the database.

How do i get it to print only the current forms deatils as a report and not all the forms.

when i press print on the form i just want it to print that form as a report, thats it, i don't need to open the report or view any other details, just print the details from the current form.

Any help guys would really be grateful.

Crann
 
DoCmd.OpenReport "Name of Report", acNormal

That should make it automatically print.

Hope that helps,
 
DoCmd.OpenReport "ReportName", , ,"[ID] = " & Me.ID

The above assumes you have a unique field on the form called ID and a similar field in the forms query/table with the same name.

This will print the report with the selected record in the form...

hth,
Jack
 
Jack Cowley said:
DoCmd.OpenReport "ReportName", , ,"[ID] = " & Me.ID

The above assumes you have a unique field on the form called ID and a similar field in the forms query/table with the same name.

This will print the report with the selected record in the form...

hth,
Jack

Hi Jack,

I'm Having problems with this i am fairly new to code etc, does this mean then that the form has to be saved before you can print it as a report?

Also i am getting errors on this code, even though i have replaced it with my details.

Any ideas

Thanks
 
What is the error that you getting? Is the ID numeric or text? If you are creating a record and then printing it immediately you need to be sure that is was saved so the report will get the data from the query or table.

Jack
 
Jack Cowley said:
What is the error that you getting? Is the ID numeric or text? If you are creating a record and then printing it immediately you need to be sure that is was saved so the report will get the data from the query or table.

Jack

Ok Jack, thanks for you help,

When i try and run the button i am getting a Compile error, method or data member not found.

I have a ID field in both my form, table and report Called: ID, and it is numeric, my report is called: Table Of Input For Plumbing.

the errors keeps highlighting the .ID at the end of the code

Am i doing something completing wrong, any advice grateful

Crann
 
This SHOULD work:

DoCmd.OpenReport "Table Of Input For Plumbing", , ,"[ID] = " & Me.ID

Check your form in design view and make sure the name of the control on the form that has the ID number is in fact named ID and not something else.

Other than that I cannot think of any other reason why the above should not work...

Jack
 
i have struck the same problem before but i found that replacing

me.[id] with me![id] fixed the error.i think it has
something to do with library references even though
access supposedly treats the dot and ! the same
 

Users who are viewing this thread

Back
Top Bottom