Access VBA - text variables !!

Joined
Feb 20, 2014
Messages
2
Reaction score
0
This one is kicking my butt!

Trying to add a row of data, one is a string, others are numbers. The quotes are killing me... Any hints? (txtA is the string...), I'm sure its yakking on that one.

CurrentDb.Execute "INSERT INTO tblPayments" _
& "([num1], [txtA], [num2], [num3], [num4])" _
& " VALUES " _
& "(" _
& quotes & Me.txt1 & quotes & ", " _
& '" & Me.txtA & "' & " , " _
& quotes & Me.txt2 & quotes & ", " _
& quotes & Me.txt3 & quotes & ", " _
& "#" & Me.txt4 & "#" _
& ");"
 
Joined
Feb 20, 2014
Messages
2
Reaction score
0
OK, maybe I'm talking to myself again... Here is the solution:


CurrentDb.Execute "INSERT INTO tblPayments" _
& "([num1], [txtA], [num2], [num3], [num4])" _
& " VALUES " _
& "(" _
& quotes & Me.txt1 & quotes & ", " _
& '"' & Me.txtA & '"' & " , " _
& quotes & Me.txt2 & quotes & ", " _
& quotes & Me.txt3 & quotes & ", " _
& "#" & Me.txt4 & "#" _
& ");"

Note the TEXT ROW (me.txtA) has ' " ' quotes around it...:bow:
 

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