Access 2007
Windows 7
So I'm somewhat back to my original problem I posted about several weeks ago, where I am attempting to set the control source of a text box based on very simple criteria: Is a field from a set of fields in my table null? If yes, set the control source to that field name. If it's not null, check the next field in the sequence to see if it is null.
Here's the code I'm working with currently, that is giving me quite a headache:
What's supposed to happen is the user selects a record with a combo box bound to a query. Upon selecting that record, the above code is supposed to set the control source of two different text boxes. One text box is supposed to be set to the first field found empty, and the second text box is supposed to be set to the field BEFORE the one found empty.
And feh...it's not working, and giving me quite a headache. I've tried firing this code from several different events, to no avail.
Any advice would be wonderful. Thank you.
Windows 7
So I'm somewhat back to my original problem I posted about several weeks ago, where I am attempting to set the control source of a text box based on very simple criteria: Is a field from a set of fields in my table null? If yes, set the control source to that field name. If it's not null, check the next field in the sequence to see if it is null.
Here's the code I'm working with currently, that is giving me quite a headache:
Code:
Private Sub Form_Current()
Dim I As Long
For I = 1 To 32
If ("DC" & I) = Null Then
Me!New_Date_Completedtxtbox.ControlSource = ("DC" & I)
If I > 1 Then
Me!Old_Date_Completedtxtbox.ControlSource = ("DC" & I - 1)
Exit Sub
End If
End If
Next I
End Sub
What's supposed to happen is the user selects a record with a combo box bound to a query. Upon selecting that record, the above code is supposed to set the control source of two different text boxes. One text box is supposed to be set to the first field found empty, and the second text box is supposed to be set to the field BEFORE the one found empty.
And feh...it's not working, and giving me quite a headache. I've tried firing this code from several different events, to no avail.
Any advice would be wonderful. Thank you.