Access query conflict

Joe C

Well-known Member
Joined
Oct 17, 2002
Messages
841
I am using SQL comands to query access and then return to excel.
In order to speed up I am creating a unique code i access, which is a concantennate of 2 fields. The problem is when I go to send to access I need to put quotes(") around the 2 columns I am using to query

If in excel my two columns lokk like this
Col A ColB
"AIC 110020"
"BBD 112525"

My query works
Of course the data looks lie this
AIC 110020
BBD 112525


I tried Dim variable as a string ad when I view it looks right with quotes but it still fails unless I go in and put A before " in column A, and after " in column B.

Can anyone let me know how I can alter the variable before I send toaccess.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi

Code:
strYourString = Chr(34) & strYourString & Chr(34)

which concatenates a " to the front and back of your string variable strYourString
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,465
Members
448,965
Latest member
grijken

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top