How do I make sure tables are closed before generating a report?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to set up a function off of a Switchboard button that does not allow a
report to be generated or printed until all forms/tables that feed
information into the report are closed. What's happening is that data are
being entered into a form, and before the form is closed, the user is wanting
to print a report that includes the newly-entered data. It appears in Access
that before newly-entered data are "saved", forms need to be closed down.
Thanks for the help!
 
I need to set up a function off of a Switchboard button that does not allow a
report to be generated or printed until all forms/tables that feed
information into the report are closed. What's happening is that data are
being entered into a form, and before the form is closed, the user is wanting
to print a report that includes the newly-entered data. It appears in Access
that before newly-entered data are "saved", forms need to be closed down.
Thanks for the help!

Your information is incorrect. The form does not have to be closed,
just the data has to have been saved before the report is opened.
Data is not saved when entered into a form until the form is closed,
another record is opened, or you expressly save the data.

Add a button to the form, not the switchboard, to open the report:
Code it's click event:
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName", acViewPreview
 
Is it just the two lines of code that need to be inserted--

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName", acViewPreview

The program won't accept these commands as-is under Private Sub Report_Open
(Cancel As Integer). I'm not familiar with Visual Basic and need some
hand-holding. Thanks!
 
Is it just the two lines of code that need to be inserted--

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName", acViewPreview

The program won't accept these commands as-is under Private Sub Report_Open
(Cancel As Integer). I'm not familiar with Visual Basic and need some
hand-holding. Thanks!



Add a button to the form,

Did you not read this part of my post?
The code goes in the form command button click event, not in the
Report Open event.
When you click the button on the form, it will save the record and
open the report.

That's all you need to save the record just added (or changed) in the
form. It will open a report in preview.
You may need to adjust the OpenReport code, adding criteria, etc., but
that's dependent upon what your needs are.
 
Back
Top