How do I print a report with data JUST taken from a form?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew

    How do I print a report with data JUST taken from a form?

    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
  • Bob Quintal

    #2
    Re: How do I print a report with data JUST taken from a form?

    spidrw@gnt.net (Andrew) wrote in
    news:d8c667d9.0 404161125.4fc4a ac9@posting.goo gle.com:
    [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 tableuniquefiel d = " & me.uniqueformco ntrol
    this creates the filter

    now all that's left is to open the report.

    docmd.openrepor t "myreport", , myrecord.
    ..

    Bob Quintal

    Comment

    Working...