Good morning all,
I have a bound continuous tabular form, that pulls in my data that I need.
However, based on data content in one field of a record, I want a checkbox in the same record enabled, so the user can check it if necessary.
I have created a record set using the form as shown below, and I am looping through each record. To show that my code is referring to the field with required data content, I display it as a message box and it works, yet my checkbox does not enable......
I have the code in the form_load event, however, for testing purposes I have it behind a button.
If I am seeing this properly, the code behind the button enables the checkbox for ALL records once the criteria in the required field is true, and based on the last record, which has no data content, it disables the checkbox in ALL records.
I also have the PK ID for each record hidden in the form. Can I utilize that to target the checkbox of each individual record??
Form Detail
Form does not allow additions or deletions. Edits allowed
All fields are disabled and locked
I only want the check box to unlock if data is found in the "RequiredField" as referred to below. I have also tried if not isNull(requiredfield.value) then enable checkbox, which yields the same results
Here is my code
Many thanks
Larry
I have a bound continuous tabular form, that pulls in my data that I need.
However, based on data content in one field of a record, I want a checkbox in the same record enabled, so the user can check it if necessary.
I have created a record set using the form as shown below, and I am looping through each record. To show that my code is referring to the field with required data content, I display it as a message box and it works, yet my checkbox does not enable......
I have the code in the form_load event, however, for testing purposes I have it behind a button.
If I am seeing this properly, the code behind the button enables the checkbox for ALL records once the criteria in the required field is true, and based on the last record, which has no data content, it disables the checkbox in ALL records.
I also have the PK ID for each record hidden in the form. Can I utilize that to target the checkbox of each individual record??
Form Detail
Form does not allow additions or deletions. Edits allowed
All fields are disabled and locked
I only want the check box to unlock if data is found in the "RequiredField" as referred to below. I have also tried if not isNull(requiredfield.value) then enable checkbox, which yields the same results
Here is my code
Code:
Dim rstMyForm As DAO.Recordset
Set rstMyForm = Forms!MyForm.Form.Recordset
rstMyForm.MoveFirst
Do While Not rstMyForm.EOF
If Not RequiredField.Value = "" Then
Checkbox.Enabled = True
MsgBox "Time Value is " & RequiredField.Value
Else
Checkbox.Enabled = False
End If
rstMyForm.MoveNext
Loop
Larry