Need help w/ syntax!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This code is in the dblck event of a lstBox called lstRNnotes. When the user
dblclks on an item I need to store it the tblRNnotes with the fldVisitNo that
is on frmRNnotes, which is linked to frmVisit by fldVisitNo.

lstVisit gets it's data from tblRNnotesLU which has canned nursing notes


I get a syntax error on the 2 lines of sql. I
would really appreciate your help with this


Dim db As DAO.Database
Dim strSQL As String
Dim varItm As Variant

Set db = CurrentDb()
With Forms!frmRNnotes!lstRNnotesLU
For Each varItm In .ItemsSelected
strSQL = "INSERT INTO tblRNnotes (fldRNnotes, fldVisitNo) " & _
"VALUES ('" & .ItemData(varItm) & "', " & .fldVisitNo Key & ")"
db.Execute strSQL, dbFailOnError
Next varItm
End With
 
Rob: Please don't be so impatient! You posted your problem at 9:30 EST, and
again at 10:29 EST. These newsgroups are manned by volunteers. Expect to
wait a while to get answers.

Keep everything in one thread, as opposed to starting new ones.
 
Thanks for the direction Doug. I'm just getting frustrated w/ my own lack of
ability to get the job done. Since I started this project I've learned alot
but keep comming up against obsticles I feel I should be able to do myself.

Any way, I hear you. Thank you for your help as always. I do appreciate you
and the other volunteers greatly. Rob
 
Back
Top