Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Unanswered: compare values from tbl1 to tbl2 in a form ??

    Hi, I have a tbl1 fields: clientID, DueDate and tbl2 fields: clientID, DatePayed. I have managed to copy both values from tbl1 to tbl2 with an INSERT query!!! Anyhoods, my concerns is the follwing;

    In form1 I have the fields tbl1.clientID, tbl1.DueDate and a 'payed' button. Once i click on the 'payed' button, the values are inserted into tbl2. clientID, tbl2.DatePay and are then displayed in another form2.

    Now, to avoid duplication, how can I compare in form1 once clicking on the'payed' button, to not to insert the values tbl1.clientID, tbl1.DueDate into tbl2 if these records already exist from the first time I copyed them values?? I was thinking of an IF statement on the 'payed' button code to validate compare the tbl1.DueDate with the tbl2.DatPayed if it already was copied or exists???

    On form1 'payed' button I have the code;

    IF Me.DueDate='how can i compare the value of tbl2.DatePayed' THEN
    msgbox"Can't insert date payed, it already has been entered!"
    exit sub
    insert .............copy values here tbl1 to tbl2........
    END IF

    If you have any idea or had similar problems or you were stuck, please advise me as I am running out of time!!! Thank you!!

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    You have one too many tables

    Are you stuck with that table structure? You would be much better off including the datepaid field in table1, then evaluating datepaid for null to turn up outstanding accounts. The if->then statement becomes pretty easy if that's a possibility.

Posting Permissions

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