Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    106

    Unanswered: Command Button Event Procedures

    how do i create an event procedure that takes a value from a combo box (that the user selects) and then works out a fine:

    IIf([Days Late]<7,0,IIf([Days Late]<14,0.3,IIf([Days Late]<21,0.6,IIf([Days Late]<28,1,IIf([Days Late]<56,1.5,IIf([Days Late]>56,3))))))

    and stores the value in the "fine" field of the "loan" table and also shows that value in the "fine" text box on the form?

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326

    Smile

    Assign to a variable your results from IIf. Run a SQL update to your table using your unique identifier: CurrentProject.Connection.Execute "UPDATE LOAN SET FINE = " & YourCalculatedVariable & " WHERE YourUniqueIndentifier = " & WhateverYourUniqueIdentifierIs & ";"

    Me.Text1.Value = YourCalculatedVariable
    Me.Repaint

    If YourUniqueIdentifier is of text, you will need to have single quotes surrounding the variable.

    So fines are free if books are returned on the 56th day?
    All code ADO/ADOX unless otherwise specified.
    Mike.

  3. #3
    Join Date
    Jan 2004
    Posts
    106
    sounds good but i hav no idea wat that means. could u type exactly wat i need to type and where it needs to go please?

  4. #4
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    CurrentProject.Connection.Execute "UPDATE LOAN SET FINE = " & YourCalculatedVariable & " WHERE YourUniqueIndentifier = " & WhateverYourUniqueIdentifierIs & ";"
    -- see http://tinyurl.com/3h9zt, the section on "How Do I Use the Connection Object in ADO"

    YourCalculatedVariable
    -- see online help String Data Type
    All code ADO/ADOX unless otherwise specified.
    Mike.

  5. #5
    Join Date
    Jan 2004
    Posts
    106
    thanks for the help!

    if anyone else has anythin to help tho, im open to suggestions

Posting Permissions

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