If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > If then else elseif

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-03-09, 08:37
Karen Day Karen Day is offline
Registered User
 
Join Date: May 2002
Posts: 147
If then else elseif

I have tried multiple ways of writing this but I am just not getting the code write. Hopefully you will be able to set me straight. I am using Access 2003.

This is the code which has been entered. I hope you can see what I am trying to do but it is just not working:

Private Sub InactiveReason_AfterUpdate()
If Not IsNull(Me.StaffActInact) Then
MsgBox "Change record to INACTIVE"

ElseIf IsNull(Me.StaffActInact) Then
MsgBox "Change record to ACTIVE"

ElseIf Me.StaffActInact = "" Then
MsgBox "Change record to ACTIVE"

Else
If Me.StaffActInact = " " Then
MsgBox "Change record to ACTIVE"
End If
End Sub
Reply With Quote
  #2 (permalink)  
Old 07-03-09, 10:01
Karen Day Karen Day is offline
Registered User
 
Join Date: May 2002
Posts: 147
Oops I feel so dumb!!

It does help if you refer to the correct field name.

The following ended up working for me:


Private Sub InactiveReason_AfterUpdate()

If IsNull(Me.InactiveReason) Then
MsgBox "You may need to change the record to ACTIVE"

ElseIf Me.InactiveReason = "" Then
MsgBox "You may need to change the record to ACTIVE"

ElseIf Me.InactiveReason = " " Then
MsgBox "You may need to change the record to ACTIVE"
Me.InactiveReason = Null

ElseIf Not IsNull(Me.InactiveReason) Then
MsgBox "You may need to change the record to INACTIVE"

End If

End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On