Hi, I have the following code in which I am doing a loop through 24 fields of a table (rather than duplicate this code 24 times), but I get an automation error on DLookup("[strAdd]"...
What do I need to do pass this string in accuractley as the field Additional1 of my table?
Cheers
tania
What do I need to do pass this string in accuractley as the field Additional1 of my table?
Cheers
tania
Code:
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblAdditionalFields", dbOpenDynaset)
Dim count As Integer
Dim strPos As String
Dim strAdd As String
Dim strNew As String
For count = 1 To 24
strAdd = "Additional" & CStr(count)
strNew = "AddNew" & CStr(count)
MsgBox strAdd
MsgBox strNew
If DLookup("[strAdd]", "tblCustomise") = False Then
Me.txtAdditional1.Visible = False
Else
Me.txtAdditional1.Visible = True
Me.LabelAdditional1.Caption = rs![strNew]
End If
Next count