Hello all. The following code fragment is giving the subject error on the execute line. There are lots of posts about this sort of thing,
and I guess I'm missing some simple syntactical point, but have wasted a lot of time moving quote marks around, etc. For info, the "x" is actually a placemark for a
string variable, but I tried to simplify to a one letter literal to find the error; made no difference. The string looks right in the msgbox - ie. all variables have the correct values - this was true even when the "x" was the intended variable - and the field names are all spelled correctly.
Would appreciate any help. Would also appreciate a link to a simple, surefire method of constructing these SQL strings for VBA.
Thanks, Ron
Code:strSQL = "" strSQL = "INSERT INTO tblShotList (ShootsFK, ShotNumber, ShotNumSuffix, fldOrderBy)" _ & " Values (" & varShootsFK & "," & varShotNum & ", x," & varCurRecOrderBy + 1 & ");" MsgBox ("The insert string is: " & strSQL) CurrentDb.Execute strSQL, dbFailOnError[ ' <=gives 3061 error