can someone please take a look at this code for me

kdt

Registered User.
Local time
Today, 15:08
Joined
Apr 5, 2006
Messages
48
Hi I'm a definite Newbie for coding (as you'll see in the example below)

I am simply trying to get an output into a Label when certain criteria are met in a form. However, the code below does not work and I can't figure out why:

Option Compare Database
Option Explicit



Private Sub Form_Current()

Dim SFStatus As String

Dim SFStatus1 As String
Dim SFStatus2 As String
Dim SFStatus3 As String

Dim TAStatus As String
Dim TAStatus1 As String
Dim TAStatus2 As String

SFStatus1 = "not assigned"
SFStatus2 = "in progress"
SFStatus3 = "completed"

TAStatus1 = "not assigned"
TAStatus2 = "assigned"
If IsNull(Me.CS_coordinator) Then

SFStatus = SFStatus1

If Not IsNull(Me.CS_coordinator) And Completed = False Then
SFStatus = SFStatus2
If Not IsNull(Me.CS_coordinator) And Completed = True Then
SFStatus = SFStatus3

If IsNull(Me.TA_receipt_date) Then
TAStatus = TAStatus1
If Not IsNull(Me.TA_receipt_date) Then
TAStatus = TAStatus2
End If
End If
End If
End If
End If


lblmessage.caption = "Your File status is" & SFStatus & "and the sample has been" & TAStatus &

End Sub

Please help :(

Thanks
 
Try something like this:

If IsNull(Me.CS_coordinator) Then
SFStatus = SFStatus1

ElseIf Not IsNull(Me.CS_coordinator) And Completed = False Then
SFStatus = SFStatus2

ElseIf Not IsNull(Me.CS_coordinator) And Completed = True Then
SFStatus = SFStatus3

End If

If IsNull(Me.TA_receipt_date) Then
TAStatus = TAStatus1

ElseIf Not IsNull(Me.TA_receipt_date) Then
TAStatus = TAStatus2

End If
 
better try with case... it's easy to manipulate later...
 
Thanks smart, it definately seems to like your code better :)

I was thinking about using case, but this will do for the time being while I learn a bit more vb

Thanks again guys
 

Users who are viewing this thread

Back
Top Bottom