Select query using SQL in ACCESS

presence76

Board Regular
Joined
May 11, 2004
Messages
76
Hello. I have been trying to write a query for some time now. I have a make table query. This is already working. I am adding to it a field that needs to have it's contents matched to an existing table. I am stripping records from a large excel spreadsheet that has a column "user". This column needs to be checked against a table (tblUserids) I have that contains the userids of the records I want to select.

In the criteria section of the make table query I have inserted some SQL code but cannot get it to get by the syntax compiler.

Here is my code:

select * where user (tblTracerImport) = User Id (tblUserids)


I get a message telling me their is sometihing wrong with the syntax. Any help would be greatly appreciated. Thanks.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Duh. It might help if I put the statement in " ". Sorry about that, it's been awhile for SQL. I did and it got by the syntax. Thanks for lettting me babble.
 
Upvote 0
Ok. Now that I fiqured that out. It does not work. The reason is that the expression builder in ACCESS takes the code in " " and puts a "like" before that and that is your query. Therefore my criteria for field "user" in the make table query reads:

Like "select * where user (tblTracerImport) = User Id (tblUserids)"

That won't work. So the question is:

Does anyone know how to put SQL into the criteria section of a make table query?

or

Does anyone have any ideas on how to solve my problem - I need to take records from a table based on values in another table.

Any help would be appreciated. Thanks.
 
Upvote 0

Forum statistics

Threads
1,221,773
Messages
6,161,855
Members
451,724
Latest member
sledparty

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