Results 1 to 4 of 4
  1. #1
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232

    If event

    I need to add to the below me.paymenttype = cash or check
    me.totalamoutdue = "cashprice"
    I tried to enter it before the else and before the end if.

    Private SubPaymentType_AfterUpdate()

    IfMe.PaymentType = "FINANCED" Then


    Me.TotalAmountDue= Me.FinancedPrice
    Else
    Me.PaymentType= "CREDIT"
    Me.TotalAmountDue= Me.FinancedPrice
    End If

    End Sub

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    So if the user doesn't enter into PaymentType either "Financed", "Cash" or "Check", the code will change the entry to "Credit".
    From your description I assume you have a textbox named CashPrice.
    Code:
    Private Sub PaymentType_AfterUpdate()
    	Select Case Me.PaymentType
    		Case "Financed"	
    			Me.TotalAmountDue= Me.FinancedPrice
    		Case "Cash", "Check"
    			Me.TotalAmountDue = Me.CashPrice
    		Case Else
    			Me.PaymentType= "CREDIT"
    			Me.TotalAmountDue= Me.FinancedPrice
    	End Select
    End Sub

  3. #3
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    You can combine the financed and credit options whether using If...Else...End If or Select Case.
    For example, using Dave's code from the previous reply

    Code:
    Private Sub PaymentType_AfterUpdate()
        Select Case Me.PaymentType
            Case "Financed", "Credit"    
                Me.TotalAmountDue= Me.FinancedPrice
            Case "Cash", "Check"
                Me.TotalAmountDue = Me.CashPrice  
        End Select
    End Sub
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  4. #4
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    Thank You this worked great...... have a wonderful day

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Key Press Event and/or Key Up Event not firing as expected
    By GraeagleBill in forum Programming
    Replies: 7
    Last Post: 01-16-2018, 04:11 AM
  2. Replies: 2
    Last Post: 10-09-2016, 05:41 PM
  3. Replies: 7
    Last Post: 05-08-2014, 10:34 AM
  4. Replies: 1
    Last Post: 03-29-2014, 07:46 PM
  5. Replies: 3
    Last Post: 05-07-2012, 12:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums