Sub FOrm - CheckBox Dependency (1 Viewer)


Registered User.
Local time
Today, 08:28
Oct 19, 2017
Hi Gentlemen,

I am working on subform where I have fields
List Items; Progress; Date;DataTickedoff(checkbox)

Progress field is lookupwizard and I have manually added 3 entries
NotCompleted ; Completed ; Not Applicable

My plan for this subforms
1- on executing the subform it will show the Progress field as Not Completed & Checkbox unchecked & Date field will remain empty

2- on selecting "Completed" Option in progress field , I want check box to be auto checked and Date field will show today's Date

3- On selecting "Not Applicable" Option in progress field , I want checkbox to be Disabled for the relevant Row Only and Date field Remain empty

Here below is my action in order to complete the Tasks:
1- I put ="Not Completed" as default value , against Progress field in related table design view.
2 & 3- For Executing 2nd& 3rdOption task I add the below code in Current event of SubForm
Private Sub Form_Current()
If Me.Progress = Completed Then
' Checkbox auto select & Date will be of todays date
Me.dataTickedOff = True
Me.Date = Date

If Me.Progress = NotCompleted Then
' Checkbox Remain Uncheck & Date will be empty
Me.dataTickedOff = False
Me.Date = Null

If Me.Progress = NotApplicable Then
' Checkbox will be Disable & Date will be Empty
Me.dataTickedOff.Enabled = False
Me.Date = Null

End If
End If
End If
End Sub

but I did not get the required result ,
the form doesn't not show me today date on selection the right field
form disabled all checkboxes for all rows if I select not applicable
and I want to just diable the checkbox of related row to disable

Kindly sir Help me out
THanks a lot
here below is the snapshot of subform datasheet


Local time
Today, 11:28
Jun 20, 2003
If Me.Progress = Completed Then

and your other similar comparison statements, have to be

If Me.Progress = "Completed" Then

Linq ;0)>

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:28
Feb 19, 2002
If the date and checkbox are controlled by the combo, both should be locked and removed from the tab order so tabbing skips over them.

The checkbox is completely redundant. Everything you are doing with the checkbox can be done via the combo.

It is not possible to enable/disable a specific control for only some instances of a continuous/DS form. Each record you see in a multi-record view is another instance of the same form. Access maintains only one copy of properties for the form. In some cases, you can use conditional formatting to control how the form looks but there are not a lot of options. If you actually want to lock/unlock a control, the code belongs in the Form's Current event and also in the Form's AfterUpdate event. The Current event runs whenever a new record gets the focus and the AfterUpdate event runs after changes were saved to the table. Since you might have changed the combo, you want to change the record you are sitting on.

Also, your If statement is nested and it shouldn't be. It will never work the way it is. Either use a case statement (preferred) or ElseIf

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom