spidrw@gnt.net (Andrew) wrote in
news:d8c667d9.0404161125.4fc4aac9@posting.google.c om:
[color=blue]
> What I'm trying to have done is the following:
> After data is entered into a form, I want the user to click
> the "Submit and print" button, which solidifies the data in
> the tables, then prints a report based on the most recent
> data.
>
> Do I need an autonumber column and have the report be based
> off the largest record number or is there an easier way to do
> it? Also, I'm not at all familiar with VBA (my small DB
> experience is in Perl and Oracle) so if there's a code snippet
> I could use, I'd greatly appreciate it.
>
> Thanks in advance!
> Andrew
>[/color]
What you want to do is have the report open filtered to only the
current record in the form, You may need the autonumber to
identify the record, but if some other field is guaranteed to be
unique to the record, use that instead.
So you would click on the button. and the OnClick event procedure
for the button would contain four statements, the first is
me.dirty = false
which saves the record.to the tables, then
then
DIM myrecord as long
The dim statement prepares a variable to hold your unique record
identifier
myrecord = "where tableuniquefield = " & me.uniqueformcontrol
this creates the filter
now all that's left is to open the report.
docmd.openreport "myreport",, myrecord.
..
Bob Quintal