Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2006

    Question Unanswered: Inserting data into table based on criteria

    I have a table with about 3 fields, - amountpaid, amountreceived and status. When the user clicks on a command button on the form 'Update', I need the system to check the amountpaid and amountreceived fields and if they (the values in the fields)matched, the status should be set to 'Cashed'; if not the status should say 'Not Cashed'. Can anyone help me with the vb code to run behind the button for this to take place. Thanks.

  2. #2
    Join Date
    Apr 2004
    outside the rim
    use an after update event on both amountpaid and amountreceived controls that checks to make sure both have a value and if so, perform the check. set the resulting value.

  3. #3
    Join Date
    Jul 2006
    create a new macro and then right click the top of that windows, select condition so that it displays conditions

    youl want to set it to
    tables![mytable]![amountpaid] = tables![mytable]![amountrecived]
    and then for the action use setvalue with these properties
    (item)= tabkes![mytable]![status]
    (value)= Cashed

    set the default value of the [status] field to Not cashed

    set the update button to run that macro

    then anytime they create a new record it will pull up as "not cashed" UNTILL they click the update button, then it will change it to cashed.

  4. #4
    Join Date
    Jun 2006

    Question Date Calculations

    Oh, one more thing, my table has four fields not three.

    I also have a date field called "ChequeDate" in the table and once 6 months or more has past, my status needs to change to stale.

    I set the default of the Status field to Not Cashed.
    Also, I created an update query so that once the user clicks the update command button on the update form, the status changes to Cashed if both fields amountpaid and amount received matches. that works fine.

    Can anyone help me with the date issue, so when the user clicks on the update button, if 6 months or more has elapsed (from the cheque date), the status changes to Stale.


Posting Permissions

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