Checkboxes

Cobra

Registered User.
Local time
Today, 23:05
Joined
Dec 8, 2008
Messages
20
How do I make an if statement which is linked to checkboxes. The code I have at the moment is:

If Me.Not_Landing = "yes" Then TxtTotal.Value = "Not Landing"
Else
If Me.Not_Landing = "no" Then
Me.TxtLand = Me.TxtLand & vbCrLf & Now()
Me.TxtLand = Me.TxtLand & vbCrLf
TxtLaunch.SetFocus
TxtTotal.Value = (TxtLand.Value - TxtLaunch.Value)
End If
End If

it says "Else without If"

What am I doing wrong D:

Thanks in advance
 
You're confusing Access by mixing the one-line and block formats of the If/Then. Try dropping everything after "Then" to the next line by itself.
 
Ok, I did that and it has stopped coming up with the error... However its just not doing anything now :eek:
 
Try putting a break point in the code at the If statement. Then get the code to run and see what values your variables are holding.

You may discover that things are not holding the values you expect or that there is a flaw in you logic somewhere.
 
Having thought a little further on your problem. The solution is that you are testing a Check box for "Yes", when in fact a check box will hold either -1 corresponding to "Yes" or 0 corresponding to "No", or possibly a Null value depending on how you have set things up.
 
Oh brilliant :D That works. Thanks so much!!! :D
 
Just a slight problem now :S I had to change the field type to accept the text if the glider was "not landing" but now the code which enters the time and date into the field works but the date doesn't display correctly:

glidingya0.jpg


instead of:
gliding2ji6.jpg
 

Users who are viewing this thread

Back
Top Bottom