
Originally Posted by
Gary
hey all,
I am using a macro to compare several textboxes on a form when a check box on a subform is clicked.
my code is:
For i = 1 To 8
box1 = "System Improvements Target #" & CStr(i)
box2 = "System Improvements #" & CStr(i)
If Not IsNull(Forms![Major Breakdowns]!Controls(box1)) Then
If IsNull(Forms![Major Breakdowns]!Controls(box2)) Then
MsgBox "Please fill in all actual dates for targets"
Me.bd_MajorReported.Value = False
End If
End If
Next
where box1 and box2 are reset to the name of a different text box on the main form, i.e. System Improvements Target #1" System Improvements Target #2" etc. based on i.
the issue is that VBA is not recognizing Forms![Major Breakdowns]!Controls(box1) that I am looking for the value of the text that has the name of the string box1
thanks in advance
Gary
Is [Major Breakdowns] the name for the sub form?
If yes, then try this:
Code:
If Not IsNull(Me.[Major Breakdowns].form![box1]) Then
Hope this helps ...
Boyd Trimmell aka HiTechCoach
Microsoft Access MVP