A.D.TEJPAL
adtp at airtelbroadband.in
Sun Jul 15 00:30:38 CDT 2007
As correctly presumed by Steve, SourceControl for the bound check box is meant to be an independent field in the table (Yes/No type). In this particular situation, it could be said that having one field for date stamp and another for Yes/No status need not necessarily be regarded as a case of storing redundant data. While Yes/No field acts as the primary one, the date stamp field (hidden from the user) is utilized to store complimentary mirror data in frozen state, with historical significance. Independently bound check box as suggested by me is dictated by user's requirement (as mentioned by John), as the primary means of recording completion of a process. If the form happens to be in continuous form or datasheet view, an unbound check box would be untenable, leading to absurd display. Taking the concept further, in order to prevent inadvertent interference, it might even be desirable to deny de-selection of check box, after it has been selected (to confirm completion of a process) and the record in question has been saved. (Any further interference with a check box in selected status could then be made conditional to authorization at higher level). Sample code in AfterUpdate & Enter events of the checkbox, as given below, should suffice, to cover the requirements outlined above. A.D.Tejpal --------------- Code in form's module (CkStaus and TxtDtStamp are names of controls for check box & hidden text box respectively) ============================= Private Sub CkStatus_AfterUpdate() ' Insert date stamp if check box is selected ' Otherwise clear the date stamp If Me.CkStatus = True Then Me.TxtDtStamp = Date Else Me.TxtDtStamp = Null End If End Sub ------------------------------------------------------ Private Sub CkStatus_Enter() ' Lock the check box if in selected state If Me.CkStatus = True Then Me.CkStatus.Locked = True Else Me.CkStatus.Locked = False End If End Sub ============================= ----- Original Message ----- From: Steve Schapel To: Access Developers discussion and problem solving Sent: Sunday, July 15, 2007 04:39 Subject: Re: [AccessD] Checkbox dates John, Using the idea that I first suggested, with an unbound checkbox's Control Source set to: =[YourDateField] Is Not Null ... will not work with the Click event. The Click event will not fire with a calculated checkbox control. It has to be the Enter event, I think. Setting the checkbox's Tab Stop property to No would prevent the type of problem you envisage. I think A.D. was suggesting the checkbox be bound to a *separate, additional* field, Yes/No data type, in the table. I don't think he meant tying to bind the checkbox to the date field itself. Regards Steve << SNIPPED >>