B
bob
When I am running the code below I am getting the
following error....
Run-time error "3265"
Item not found in this collection.
The message says...
An attempt to reference a name in a collection failed.
Possible causes:
1)the object doesn't exist in this collection. Make sure
that the object is
appended to collection before referencing it.
2)There is more than one object with this name in this
collection; using
its
name with this name is an ambiguous reference. reference
the object by its
original position in the collection for e.g.. recordsets
(3)).
Code..........
private sub command 46_click()
Dim rs As DAO.Recordset
Dim db As DAO.Database ' for insert queries
Dim strsql As String
Set db = CurrentDb
Set rs = Me.RecordsetClone
With rs
If .RecordCount <> 0 Then .MoveFirst
Do Until .EOF
strsql = _
"INSERT INTO tblAttendance " & _
"(StudentClockNum, ProgramCode,
CourseNum, " & _
"LoginTime, Exempt, SHours) " & _
"VALUES (" & _
"'" & !studentclocknumber & "', " & _
"'" & !ProgCode & "', " & _
"'" & !CNum & "', " & _
Format(!Login, "\#mm/dd/yyyy
hh:nn:ss\#") & ", " & _
!Check54 & "," & _
!THours & ")"
' Uncomment if needed for debugging:
Debug.Print strsql
db.Execute strsql, dbFailOnError
.MoveNext
Loop
End With
Set rs = Nothing
Set db = Nothing
End Sub
following error....
Run-time error "3265"
Item not found in this collection.
The message says...
An attempt to reference a name in a collection failed.
Possible causes:
1)the object doesn't exist in this collection. Make sure
that the object is
appended to collection before referencing it.
2)There is more than one object with this name in this
collection; using
its
name with this name is an ambiguous reference. reference
the object by its
original position in the collection for e.g.. recordsets
(3)).
Code..........
private sub command 46_click()
Dim rs As DAO.Recordset
Dim db As DAO.Database ' for insert queries
Dim strsql As String
Set db = CurrentDb
Set rs = Me.RecordsetClone
With rs
If .RecordCount <> 0 Then .MoveFirst
Do Until .EOF
strsql = _
"INSERT INTO tblAttendance " & _
"(StudentClockNum, ProgramCode,
CourseNum, " & _
"LoginTime, Exempt, SHours) " & _
"VALUES (" & _
"'" & !studentclocknumber & "', " & _
"'" & !ProgCode & "', " & _
"'" & !CNum & "', " & _
Format(!Login, "\#mm/dd/yyyy
hh:nn:ss\#") & ", " & _
!Check54 & "," & _
!THours & ")"
' Uncomment if needed for debugging:
Debug.Print strsql
db.Execute strsql, dbFailOnError
.MoveNext
Loop
End With
Set rs = Nothing
Set db = Nothing
End Sub