Help with a simple append query

  • Thread starter Thread starter Joe Cilinceon
  • Start date Start date
J

Joe Cilinceon

Access 2000 with this simple append query to add a record to a letter sent
table.


strSQL = "INSERT INTO tblTenantLetters ( CustNo, PrintDate, LetterType ) " &
_
"VALUES ( " & Me.CustNo & ", #" & Date & "#, 3 ) ;"

I use almost the exact same syntax on a much larger append query without
problem. now I get not valid SQL

I have even tried to change it as below:

strSQL = "INSERT INTO tblTenantLetters ( CustNo, PrintDate, LetterType ) "
strSQL = strSQL & "VALUES ( "
strSQL = strSQL & Me.CustNo & ", #"
strSQL = strSQL & Date & "#, 3 ) ;"
 
Are you getting an error message?

Is CustNo a text field? If so, try

"VALUES(""" & me.CustNo & """, #" & Date() & "#, 3)"
 
I got it with the method below

strSQL = "INSERT INTO tblTenantLetters ( CustNo, PrintDate, LetterType,
[Note] )" & _
" SELECT " & [CustNo] & " AS CustNo, #" & Date & "# AS
PrintDate, " & _
"3 AS LetterType, '" & strNote & "' As [Note] ;"

Still don't know why it didn't work but got the one above to work. Thanks
for responding John.
 
Back
Top