How prevent typing in datasheet depending on other field

  • Thread starter Thread starter Fjordur
  • Start date Start date
F

Fjordur

Hi,
I've got a subform displayed as datasheet, with
1) a field "limitless" that's a checkbox, locked, maybe true or false (duh!)
2) a field "limitDate" that's a date to be input ONLY if "limitless" is
false
The data is created by a query that does not define the limitDate, so it is
empty.
I would like the "limitDate" to be locked whenever "limitless" is true. I
tried to set the locked property to true in the "current" event of the form
but it does not work, if only because the form can be selected by clicking
right into "limitDate" (remember, this is datasheet display).
How can I manage that the limitDate field stays, and is displayed, empty?
Thanks,
 
Try this instead. The first section is for the Current Event of your form.
The second is for the Click Evnet of you Limitless field.

Private Sub Form_Current()
If Not IsNull(Me.Limitless) Then
If Me.Limitless Then
Me.LimitDate.Locked = True
Else
Me.LimitDate.Locked = False
End If
End If
End Sub

Private Sub Limitless_Click()
If Me.Limitless Then
Me.LimitDate.Locked = True
Me.LimitDate = Null
Else
Me.LimitDate.Locked = False
End If
End Sub


--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top