Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2001
    Posts
    175

    Unanswered: Help with Code on Report

    I am trying to run the following code on the Print function of the Detail section of a Report but it's not working.

    Not sure if my code is correct but what I am trying to do is update the table tblAllPols and set the Paid field (Yes/No field) to Yes where the tblAllPols.InvNo is equal to the invoice numbers on the report and where the tblAllPols.Premium + tblAllPols.Tax fields in the tblAllPols table are equal to the tblAllPols.RecAmt field.

    For example the following appears in the details section of my report:

    InvNo Premium Tax RecAmt
    0001 100.00 10.00 100.00
    0002 200.00 20.00 220.00
    0003 500.00 50.00 550.00

    I want to update the Paid field to Yes for InvNo 0002 and 0003 in the tblAllPols because the both InvNos appeared on the report and for both the Premium+Tax is equal to the RecAmt

    InvNo Premium Tax RecAmt Paid
    0001 100.00 10.00 100.00 No
    0002 200.00 20.00 220.00 Yes
    0003 500.00 50.00 550.00 Yes

    Code
    ----
    Dim uquery As String

    uquery = "update tblAllPols set tblAllPols.Paid = 'Yes' where [tblAllPols].[InvNo] = " & Me!InvNo & " and (tblAllPols.Premium + tblAllPols.Tax) = tblAllPols.Recamt"
    DoCmd****nSQL uquery

    Thanks
    Toukey

  2. #2
    Join Date
    Sep 2006
    Posts
    265
    The Flag should be set upon Receipt of a payment not on the Report.

    Invoice 0001 flag should be "P" Part Paid.

    Simon
    Last edited by SimonMT; 04-16-10 at 20:07.

  3. #3
    Join Date
    Sep 2001
    Posts
    175
    Thanks - I'll see how I can use that.

Posting Permissions

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