Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For me this is a complex sql string

Status
Not open for further replies.

jslmvl

Vendor
Jan 26, 2008
268
GB
Hi,

In VB6+Access, I got error by the sql string:

sql = "Select * From Table1 Where [User] In (Select Table1.[User] From Table1 " & _
"Left Join (Select Table2.[User] From IN '' [MS Access;PWD=123456;DATABASE=" & aFileName & "] " & _
"Group By Table2.[User]) As t On Table1.[User]=t.[User]) "

Can you correct for me?
I will be very appreciated if you explain how to do such complex sql string.
 
I got error
Which error ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry, I should have made my question clearer, the error was

Run-time error '-2147467259(80004005)':
Syntax error in FROM clause.
 
I'd use linked table instead of the IN clause.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I don't know "linded table", can you show me an example?
 
I don't know "linded table", can you show me an example?
Try the MS Access Help file for linked table. It's a linked table as apposed to imported table.

PHV is telling you it'd be best to first link in the external table, and THEN refer to that linked table in your SQL code, thus removing the difficult SQL part altogether.

--

"If to err is human, then I must be some kind of human!" -Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top