accessjunior
accessjunior

Reputation: 11

If statement in access

If IsNull(CusID) Or IsNull(Me.CusID) Then
    Beep
    MsgBox "Specify a Customer or enter CustomerID to proceed", vbCritical
    CusID.SetFocus
End If

If IsNull(paymenttype) Or IsNull(Me.paymenttype) Then
    Beep
    MsgBox "Please specify payment type", vbCritical
    paymenttype.SetFocus
End If

If IsNull(payment) Or IsNull(Me.payment) Then
    Beep
    MsgBox "Please enter any amount to proceed payment.", vbCritical
    payment.SetFocus
End If

Please if someone help me to put these if statement into a if else....something to check step by step the action of if statement. This is from a form name 'payment' then i need to make sure that none of this text boxes are null or empty before proceed payment....please help

Upvotes: 1

Views: 107

Answers (1)

tkhm
tkhm

Reputation: 880

Do you mean like the following?:

If IsNull(CusID) Or IsNull(Me.CusID) Then
  Beep
  MsgBox "Specify a Customer or enter CustomerID to proceed", vbCritical
  CusID.SetFocus

ElseIf IsNull(paymenttype) Or IsNull(Me.paymenttype) Then
  Beep
  MsgBox "Please specify payment type", vbCritical
  paymenttype.SetFocus

ElseIf IsNull(payment) Or IsNull(Me.payment) Then
  Beep
  MsgBox "Please enter any amount to proceed payment.", vbCritical
  payment.SetFocus

End If

I added just "Else" before "If" along the MS ACCESS: IF-THEN-ELSE STATEMENT

Upvotes: 1

Related Questions