problems with a vba statement, plz help, ty. sam

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

Guest

strMySql = "INSERT INTO AgencyLogTbl (PricelistID, DateWorked, ShiftID)" & _
" SELECT Me!PriceListID AS Expr1, " & _
" Me!DateWorked AS Expr2, 12 As Expr3;"
rs2.Open strMySql, CurrentProject.Connection

something is wrong, can't find it. i am new to ado.

thanks,

sam
 
strMySql = "INSERT INTO AgencyLogTbl (PricelistID, DateWorked, ShiftID)" & _
" SELECT Me!PriceListID AS Expr1, " & _
" Me!DateWorked AS Expr2, 12 As Expr3;"
Try this
"INSERT INTO AgencyLogTbl ( PricelistID, DateWorked, ShiftID) VALUES (" &
Me!PriceListID & ", " & Me!DateWorked & ",12)"

If the values from the form are text, you need to add a single quote before
and after the value
"INSERT INTO AgencyLogTbl ( PricelistID, DateWorked, ShiftID) VALUES ('" &
Me!PriceListID & "', '" & Me!DateWorked & "',12)"
 
thank you thank you, it worked.

i would have never gotten it right. you are truly amazing.

sam
 

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

Back
Top