RunSql string shorten to 255 characters

G

Greg

I have a function which insert data into a table with docmd.runsql, but the
sql string is longer that 255 characters, is truncated to 255, and fails.
what am I doing wrong ?

str_SQLString = "INSERT INTO [Structural Sizes] (Structural_Type_ID, SIZE,
MASS, GRADE, Grade_Label, CROSS_SECTION_AREA, " & _
"SURFACE_AREA, D, B, D/2, B/2, Max_Web_Notch_Depth,
Min_Web_Notch_Depth)" & _
" SELECT 'Plate', '" & strSize & "', " & dblMass & ",
" & dblGrade & ", '" & _
strGrade & "', " & dblCROSS_SECTION_AREA & ", " &
dblSURFACE_AREA & ", " & Width & ", " & Thickness & ", " & _
dbl_D2 & ", " & dbl_B2 & ", " &
dbl_Max_Web_Notch_Depth & ", " & dbl_Min_Web_Notch_Depth & ";"
DoCmd.RunSQL (str_SQLString)
 
A

Allen Browne

Use Execute instead of RunSQL, e.g.:
dbEngine(0)(0).Execute strSQLString, dbFailOnError

For details, examples, and a list of the advantages and pitfalls, see:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
 

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

Top