Need help w/ syntax!

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
 
D

Douglas J. Steele

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Syntax error 14
Stuck, Need Help w/ Code 3
Getting no where 1
Erro 3201 3
Run-time Error '2480' 3
Code Help 10
combo box - Help! 2
Syntax (Missing Operator) in Query Expr .... 2

Top