Hi everyone. Sorry this may get a bit long here trying to explain but I'm working on building a database that will be used for tracking enrollments & terminations in some classes that we offer at work for clients. There are two main tables TblClientDemogr aphics and TblAnnualEnroll ment. They are linked as a "one to many" based on an unique ID number for each client. What I'm currently working on is a bound single form used to edit the annual enrollment information for a particular client.
Where I'm stuck is at the point that there are checkboxes for "Enrollment " and "Terminated " from the program. I want to restrict these two entries so that the providers can not check the terminated unless the client is enrolled, and also restrict so that the enrolled entry can't be changed to a null value if terminated is checked (basically can't be terminated unless they are enrolled)
I created the checkboxes as not visible and then created textboxes with transparent cmd boxes over them so I could use conditional formatting but I'm missing something.
Controls are: [Terminated] & [Enrolled] are the hidden checkbox controls & the bound fields to the table; [ChkEnrollTxt] & [ChkTermTxt] are the textboxes that are unbound and set up with control sources as =IIf([Terminated],Chr(82),"") and the same for Enrolled; and then I have [EnrollTransCmd] & [TermTransCmd] for the two transparent command buttons that are over the top of the two text boxes.
Code that I have currently trying to make this work:
_______________ _______________ __________
With this code the TermTransCmd button is disabled when you go to the edit form, when you click the Enroll it enables the Terminated but when you click terminated it doesn't disable the enroll so the entry person can remove the enrollment without clearing the terminated field. Any ideas? I'm wondering if it's something to do with the On Update but when, for example you actually click both the enroll and then terminated and then remove both of them the terminated becomes disabled again. I tried to put the enabled=True or false statements on the actual checkboxes (hidden) on the after update also but that didn't work either.
I'm stumped. Thanks
Where I'm stuck is at the point that there are checkboxes for "Enrollment " and "Terminated " from the program. I want to restrict these two entries so that the providers can not check the terminated unless the client is enrolled, and also restrict so that the enrolled entry can't be changed to a null value if terminated is checked (basically can't be terminated unless they are enrolled)
I created the checkboxes as not visible and then created textboxes with transparent cmd boxes over them so I could use conditional formatting but I'm missing something.
Controls are: [Terminated] & [Enrolled] are the hidden checkbox controls & the bound fields to the table; [ChkEnrollTxt] & [ChkTermTxt] are the textboxes that are unbound and set up with control sources as =IIf([Terminated],Chr(82),"") and the same for Enrolled; and then I have [EnrollTransCmd] & [TermTransCmd] for the two transparent command buttons that are over the top of the two text boxes.
Code that I have currently trying to make this work:
Code:
Private Sub EnrollTransCmd_AfterUpdate() If Me.Enrolled = -1 Then Me.TermTransCmd.Enabled = True ElseIf Me.Enrolled = 0 Then Me.TermTransCmd.Enabled = False End If End Sub Private Sub EnrollTransCmd_Click() Me!Enrolled = Not Me!Enrolled End Sub Private Sub Form_Current() If Me.Enrolled = -1 Then Me.TermTransCmd.Enabled = True ElseIf Me.Enrolled = 0 Then Me.TermTransCmd.Enabled = False End If End Sub Private Sub TermTransCmd_AfterUpdate() If Me.Terminated = 0 Then Me.EnrollTransCmd.Enabled = True ElseIf Terminated = -1 Then Me.EnrollTransCmd.Enabled = False End If End Sub Private Sub TermTransCmd_Click() Me!Terminated = Not Me!Terminated End Sub
With this code the TermTransCmd button is disabled when you go to the edit form, when you click the Enroll it enables the Terminated but when you click terminated it doesn't disable the enroll so the entry person can remove the enrollment without clearing the terminated field. Any ideas? I'm wondering if it's something to do with the On Update but when, for example you actually click both the enroll and then terminated and then remove both of them the terminated becomes disabled again. I tried to put the enabled=True or false statements on the actual checkboxes (hidden) on the after update also but that didn't work either.
I'm stumped. Thanks
Comment