R
Rosco
I hope someone can help me here. I have used versions of the code
below many times without a problem. In my current project, for some
reason, I can not get this to work.
The goal of this code is to build an include statement for a delete
query, based on all records in a given table (tblWLKey). The table
only contains 1 field.
I am getting hung up on the "dblWLKey = [WLKEY]" statement. I get a
Runtime error 2465 - "Microsoft Access can't find the field '|'
refered to in your expression".
The table opens, and the record count is correct, so I know the sub is
seeing the record set.
I can't seem to find my error.
Sub Test1()
Dim db As Database, rs As Recordset, dblWLKey() As Double,
Dim StrWLKey As String, Count As Integer, i As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("tblWL_Keys", dbOpenTable)
Count = rs.RecordCount
i = 1
ReDim dblWLKey(Count)
Do While i <= Count
With rs
dblWLKey = [WLKEY]
StrWLKey = "IN(" & StrWLKey & "," & dblWLKey & ")"
Debug.Print StrWLKey
.MoveNext
i = i + 1
End With
Loop
End Sub
Any help is appreciated
Rosco
below many times without a problem. In my current project, for some
reason, I can not get this to work.
The goal of this code is to build an include statement for a delete
query, based on all records in a given table (tblWLKey). The table
only contains 1 field.
I am getting hung up on the "dblWLKey = [WLKEY]" statement. I get a
Runtime error 2465 - "Microsoft Access can't find the field '|'
refered to in your expression".
The table opens, and the record count is correct, so I know the sub is
seeing the record set.
I can't seem to find my error.
Sub Test1()
Dim db As Database, rs As Recordset, dblWLKey() As Double,
Dim StrWLKey As String, Count As Integer, i As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("tblWL_Keys", dbOpenTable)
Count = rs.RecordCount
i = 1
ReDim dblWLKey(Count)
Do While i <= Count
With rs
dblWLKey = [WLKEY]
StrWLKey = "IN(" & StrWLKey & "," & dblWLKey & ")"
Debug.Print StrWLKey
.MoveNext
i = i + 1
End With
Loop
End Sub
Any help is appreciated
Rosco