Enable controls on my Subform!

G

Guest

I have on my main form the following information on my form

Main Form: Source = tblEmployee
EmployeeID

Subform: Source = tblCourseTraining .........(Continous form)
CourseTrainingID (PK)
COurseID(FK)
EmployeeID(FK)
Completed (YES/NO)
DateCompleted(Date)

this is what I would like to do is when I open the form, is is there is no
course (ie the CourseID) selecected Completed and Date completed should stay
disabled.
If I select a course, then the Completed should be enabled
If I mark Completed to indicate that the course is completed, then the
DateCompleted should be be enabled so that one can enter a date.

How should I do this, your replies would greatly be appreaciated!
 
G

Guest

In the subform set the enabled properties of Completed and DateCompleted to No.

In the After Update event of COurseID use:

Private Sub COurseID_AfterUpdate()
If not isnull(me.CourseID) Then
me.Completed.Enabled=True
Else:
me.Completed.Enabled=False
Me.DateCompleted.enabled=False
End If

In the After Update event of Completed use:
Private Sub Completed_AfterUpdate()

If me.Completed=True Then
me.DateCompleted.Enabled=True
Else:
Me.DateCompleted.enabled=False
End If

End Sub
 
G

Guest

Jim, thanks for the reply, however, this worked partially, you see my form is
a contious subform When I first open the form, everything is disabled but
when I select a course, everything in the subform is enabled but I only want
that courseID to have the complete to be enabled and if I click on the
completed, the date should then be enabled and not everything else in the
subform..
 

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

Top