Haha even after all those changes/ suggestions, I am still getting the same error on the same line. When I was first looking into doing this, I was experimenting with a code that is similar to this:
This exact code isn't working for me right now, but I was wondering if something similar could be used to loop through the controls.
Code:
Private Sub Update_Click()
Dim Narr() As Variant
Dim i as Integer
Dim ctrl as Control
i = 1
For Each ctrl In Me.Controls
If Me.("Check" & i) = True Then
ReDim Preserve Narr(i)
Narr(i) = ctrl.DefaultValue
i + 1 = i
End If
Next
If i > 0 Then
For j = 1 To UBound(Narr) - 1
RecsChose = RecsChose & "Trailers_Unloading_LA.Door=" & Narr(j) & " OR "
Next
RecsChose = RecsChose & "Trailers_Unloading_LA.Door=" & Narr(j) & ";"
sqlP1 = "SELECT Trailers_Unloading_All.Door, Trailers_Unloading_All.Trailer_Number FROM Trailers_Unloading_All WHERE "
sqlStr = sqlP1 & RecsChose
Else
ErrMess = MsgBox("Nothing Checked", vbOKOnly, "Status")
End If
DoCmd.OpenForm "UnloadNow", acNormal, sqlStr
Comment