problems inserting numbers into mysql backend (1 Viewer)

bbwolff

Registered User.
Local time
Today, 14:05
Joined
Oct 1, 2013
Messages
116
I'm trying to change my backends to mysql.
I have the following routine
enter new person data, get the ID in main table, write that as foreign key in table 2, which should be straightforward. But I can't get this to work

Code:
DoCmd.RunSQL "insert into table (tOrigo, tDel,t-bID) values ('" & Me.tTum & "','" & Me.tDel & "', '" & lkp & "')"

where lkp is the lookup number. I also tried the version without '2&, same story.

it worked in before when i used access backend, but now it returns syntax error in insert into sentence, run time error 3134.

Maybe it has something to do with data types? mysql declares integer as 4 byte number, but nothing really changes when i define lkp as either integer or long.
Or as usually it might be a foolish syntax error
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:05
Joined
Aug 30, 2003
Messages
36,126
If the data type is numeric, I don't think you want the single quotes around that value (you wouldn't with Access or SQL Server). Also, you may need to bracket the field name with the inadvisable symbol in it. This may help:

http://www.baldyweb.com/ImmediateWindow.htm
 

bbwolff

Registered User.
Local time
Today, 14:05
Joined
Oct 1, 2013
Messages
116
If the data type is numeric, I don't think you want the single quotes around that value (you wouldn't with Access or SQL Server). Also, you may need to bracket the field name with the inadvisable symbol in it. This may help:

http://www.baldyweb.com/ImmediateWindow.htm

as i said, a foolish syntax error, bracketing solved all my problems. Tx
 

Users who are viewing this thread

Top Bottom