Report from new record in form

benc

Registered User.
Local time
Today, 06:52
Joined
Dec 31, 2001
Messages
57
I need some help in printing a report from a form that the person has just a filled in. The print this record button doesnt work as i only prints what you see in that form and as i have tabs on my form it wont print all of it. I thought about after the form had been filled in and the print report button had been clicked that the form would create a Global viariable and then the report could generate itself by looking up the data and using the GV as a reference. But not sure on how what where i enter the code in the report to generate it. Can anyone help. Thanks
 
Create the report based off the table your form is based on.

Write this as a SQL statement into the OnOpen event of the form, setting the recordsource property to the SQL and make the SQL point to the current record you want to print.

In the onActivate for the report test if the form is loaded if it is then close it.

This will produce a report based on a query, based on your form, then close the form.

If the record in the form is not saved prior to running the report you may have a problem, I normally force save teh record to ensure it is saved.
 
i tried it

Hi I didnt really understand what you said so i tried a different way. i created a query with all the relevant fields in. in the id number of the record for that form under criteria i wrote:

[forms]![book]![Booking Reference]

I then create a report based on this query. in the form i created this button to force a save and then print the report. the code for this button was:

Private Sub Print_booking_form_Click()

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "Booking form", acNormal

End Sub

However the button printed the report but there were no details on it it. but after closing the form i ran the report by itself it asked me for the id number which i entered and it then game me all the correct details. can anyone help as to why the button wont take the details
 

Users who are viewing this thread

Back
Top Bottom