Preview report

J

Jim L.

I am working on an inventory form that opens in add mode. As information is
entered, I would like to be able to see the results on the related report
(along with expression results) as a "checks & balances" thing, so users can
see if they have entered incorrect information before it is written to the
table. I have tried running a macro attached to the "preview report" command
button, to save the form, then open the report in print preview, but no
report shows up. When I check the table (with the form still open), the
information from the form has not yet been saved to the table. Is there an
easy answer to to this problem for a beginner user?
Thanks for any & all help.
 
R

Rob Parker

Hi Jim

The short answer to your problem is "You can't do that".

The explanation is as follows (and when I say "table", you can take it to
read "query based on table(s)"). Data entered into a form, via controls
bound to fields in a table, is not saved immediately it is entered into the
control, but when an event occurs which forces the entire record to be
saved - normally, moving to another record, or closing the form. Prior to
that, the form's Dirty property (which allows it to tell whether any of the
controls/fields have changed since it was opened) will be True if any data
has been entered or edited; however, the new entries/edits have not yet been
saved to the underlying table. Your report will be based on the same table,
but it cannot show data from a dirty form until that data has been saved to
the table.

You say that you run a macro "... to save the form ...". Saving a form will
save any changes to the form's design (which you cannot have made if it's
only open in add mode), it will not (and is not intended to) save changes to
the data entered into the form.

A possible solution to your problem might be to use the form's BeforeUpdate
event to run some code to validate the input in the various fields.

HTH,

Rob
 

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