Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Require field input if check box true

Status
Not open for further replies.

pd06498

IS-IT--Management
Dec 10, 2003
36
AU
I have a form that has check boxes indicating if a task is completed. I also have fields on the same form to input the date these tasks were completed.
I want to make the user enter a date if the check box is true, otherwise leave blank and tab past date field to the next field.
 
Hi,

This may be simpler than you think.

When the user clicks the checkbox (to indicate that the task is complete) - it IS complete at that point - no?

Therefore, why not enter the date (and time if reqd) as they click that?

i.e. In the <On Change> event of the checkbox use this code......
[tt]
if(mycheckbox = true) then
mydatefield = now()
else
mydatefield = &quot;&quot;
fieldiwantwithfocus.setfocus
endif
[/tt]

Hope this helps.

Regards,

Darrylle





&quot;Never argue with an idiot, he'll bring you down to his level - then beat you with experience.&quot; darrylles@totalise.co.uk
 
Thanks Darryle

Only problem is that the databese might not be updated for several days after the task is completed. The database is to record paperwork. Would it perhaps be easier to reverse the situation so that when the completion date is entered, the check box is changed to true?

Thanks

PS: Using Access 2000
 
Hi,
Us the code below afterupdate event of the Checkbox

=====================================
Private Sub CheckBox_AfterUpdate()
If Me.CheckBox = True Then
If IsNull(Date) Then
MsgBox &quot; Please enter the date&quot;
Me.Date.SetFocus
End If
End If
End Sub
======================================
Regards

Zameer Abdulla

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top