Check box issue

fixious123

Registered User.
Local time
Today, 14:51
Joined
Oct 3, 2002
Messages
49
This should be fairly easy, just not for me. I have a text box on a form that uses DateAdd calculation. I want the textbox to say Series Complete if Checkbox is checked or True and if not continue to use the DateAdd Calculation. This is what I have so far but its off... Any help appreciated. Thanks.

Private Sub Check384_Click()
If Check384 = True Then
Me.Text87 = "Series Complete"
ElseIf Check384 = False Then
Text87 = DateAdd("m", 6, [Hepatitis A Taken])
End If
End Sub
 
If doesn't work like that. It's
- Condition true or false
- Action if true
- Action if false

So

Private Sub Check384_Click()
If Check384 = True Then
Me.Text87 = "Series Complete"
Else Me.Text87 = DateAdd("m", 6, [Hepatitis A Taken])
End If
End Sub

should work, I think.

Appologies if this is not the whole answer - brain in overload today
 
neileg, that's not strictly true. Though I don't think it's the case here, it's possible to have a triple-state checkbox that goes between True/False/Null.
 
dcx693 said:
neileg, that's not strictly true. Though I don't think it's the case here, it's possible to have a triple-state checkbox that goes between True/False/Null.
Yeah, OK, but the If statement says
If Check384 = True
so the true part will only be evaluated if the checkbox is checked. If it is false or null, then the false part will be evaluated.

But your observation is still valid.
 
Thanks

neileg said:
Yeah, OK, but the If statement says so the true part will only be evaluated if the checkbox is checked. If it is false or null, then the false part will be evaluated.

But your observation is still valid.


Worked like a charm, thanks for the inputs. Only thing is I had to make it bound so it would change betwen records and change the box from a date to text so the date isn't what I want. It shows i.e. 7/23/2003 instead of 23 Jul 03 like I would like.
 
Code:
Format(DateAdd("m", 6, [Hepatitis A Taken]), dd mmm yy)

I'm not too sure about that one, may have to look it up, bit its along those lines. :D
________
Alaska Dispensary
 
Last edited:
Checkbox

a.sinatra said:
Code:
Format(DateAdd("m", 6, [Hepatitis A Taken]), dd mmm yy[PHP]

I'm not too sure about that one, may have to look it up, bit its along those lines.  :D[/QUOTE]



This is what I have and its coming up with a compile error

Private Sub Check649_Click()
If Check649 = True Then
Me.HepA = "Series Complete"
Else: Me.HepA = Format(DateAdd("m", 6, [Hepatitis A Taken]), dd mmm yy
End If
End Sub
 
Oops, something happened and it "ill-posted".
Code:
Private Sub Check649_Click()
     If Check649 = True Then
          Me.HepA = "Series Complete"
     Else
          Me.HepA = Format(DateAdd("m", 6, [Hepatitis A Taken]), dd mmm yy)
     End If
End Sub
________
Colorado Marijuana Dispensary
 
Last edited:
a.sinatra said:
Oops, something happened and it "ill-posted".
Code:
Private Sub Check649_Click()
     If Check649 = True Then
          Me.HepA = "Series Complete"
     Else
          Me.HepA = Format(DateAdd("m", 6, [Hepatitis A Taken]), dd mmm yy)
     End If
End Sub



Coming up with Syntax error. Any ideas on where the problem is? The dateadd line is coming up red.
 
Code:
Private Sub Check649_Click()
     If Check649 = True Then
          Me.HepA = "Series Complete"
     Else
          Me.HepA = Format(DateAdd("m", 6, [Hepatitis A Taken]), "Medium Date")
     End If
End Sub
________
CESARE PERDISA
 
Last edited:
a.sinatra said:
Code:
Private Sub Check649_Click()
     If Check649 = True Then
          Me.HepA = "Series Complete"
     Else
          Me.HepA = Format(DateAdd("m", 6, [Hepatitis A Taken]), "Medium Date")
     End If
End Sub


Works perfect...
 

Users who are viewing this thread

Back
Top Bottom