I posted this in the wrong forum. I meant to post in MSSQL. Sorry. I tried to delete the post but it won't let me.
Can you move it so I don't have to double post?
I am looking to concatenate values in a SQL statement but a VB 'With' statement seems to be throwing me some errors. The syntax appears correct in the reference I am using but the live compiler does not like the string. Here is the code:
' Get the user color controls recordset
strSQL = "SELECT fldTextBoxB, fldTextBoxF, fldFrameB, fldFrameF, fldLabelB, fldLabelF, fldComboBoxB, fldComboBoxF FROM tblUsers" & _
"WHERE fldUserID = 'JoeUser'"
'Set cursor type and lock type?
'Static is the only method available for .CursorLocation=adUseClient
objRst.Open strSQL, objCnn, adOpenStatic, adLockPessimistic
Do Until objRst.EOF
strSQL = "BEGIN TRANSACTION INSERT INTO tblUsers VALUES('" & _
!fldTextBoxB & "', '" & _
!fldTextBoxF & "', '" & _
!fldFrameB & "', '" & _
!fldFrameF & "', '" & _
!fldLabelB & "', '" & _
!fldLabelF & "', '" & _
!fldComboBoxB & "', '" & _
!fldComboBoxF & "')"
If .EOF Then
strSQL = strSQL & "COMMIT TRAN"
'Execute the SQL statement