Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Apr 2001
    Location
    Naperville, Illinois, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Record Available (Access 2002)

    In a procedure, I add a record to an ADO database in a 'With..End with' structure. If I do a lookup on the record, finding its autonumber ID, I am successful. However, when I call a report and pass it the autonumber id in a search link, the query behind the report doesn't see the record in the table.

    .ADDNew
    .Fields("ciid") = CO
    .Fields("Payee1") = Me.txtPayee1
    .Fields("payout1") = fPay1
    .Fields("Payee2") = Me.txtPayee2
    .Fields("payout2") = fPay2
    .Fields("Payee3") = Me.txtPayee3
    .Fields("payout3") = fPay3
    .Fields("payouttype") = "CO"
    .Fields("UserID") = GetUser
    .Update

    nID = DMax("[PayoutsTblID]", "tblPayouts")
    sRptLink = "[PayoutsTblID] = " & nID - finds the correct id number
    (at this point, I can go to the table and see the record but the query behind the report doen't see it - do I need to do some other kind of save?)
    DoCmd.OpenReport "rptPayout", acViewPreview, , sRptLink

    Thanks in advance.

    Alan

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Record Available (Access 2002)

    The .Update line saves the record to the table. That DMax finds the correct number is witness to that - DMax looks at the stored version of the table, not at the recordset in memory. So if the report doesn't "see" the record, there must be something else behind it. Does the query behind the report contain criteria that might exclude the latest record?

  3. #3
    Star Lounger
    Join Date
    Apr 2001
    Location
    Naperville, Illinois, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Record Available (Access 2002)

    Thanks, I found the problem in the query sitting behind the report. It was looking for another record that hadn't been written yet. Thanks for your help.

    Alan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •