unbound fields reordset error

  • Thread starter Thread starter bob
  • Start date Start date
B

bob

I am getting closer. Now the error I am getting is
that ....at line db.execute...

and the error is runtime'3061'
Too few parameters . Expected 1.


Also, my question is I am not doing anything wrong here in
creating the recordset right? I mean I can createa
Recordset from a form where some fields are bound and the
others are unbound.

For my fields....

Studentclocknum is text
Shours is numbers
programcode is text
cnme is text
logintime is date
logout is date
exempt is a text...a check box?


my syntax is right?



Private Sub Command46_Click()


Dim db As DAO.Database
Dim strsql As String

Set db = CurrentDb

With Me.RecordsetClone

..MoveFirst

Do Until .EOF

'begin of the insert statement to insert the records

strsql = _
"Insert into tblattendance " & _
"(StudentClockNum,programcode,coursenum,exempt,
shours) " & _
"Values (" & _
.Fields("StudentClockNum") & ", " & _
Me!ProgCode & ", " & _
Me!CNum & ", " & _
Me!Check60 & "," & _
.Fields("thours") & _
");"

db.Execute strsql, dbFailOnError

..MoveNext
Loop
End With


Set db = Nothing

End Sub
 
Please do not multi-post on the same question.

I advised in your later post that you need to enclose Text
values in single or double quotes. The error occurred
because you passed Text values without enclosing them in
quotes.

Use Debug.Print (as advised in the later thread)to check
the actual SQL String being passed to JET.

HTH
Van T. Dinh
MVP (Access)
 
Back
Top