By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Local Temporary Table - SQL

P: n/a
Hi there,

I'm trying to figure out a way to run an INSERT INTO sql statement that
will create a local, temporary table based on external data in a
user-level, secured Access database.

Following is sample code of the setup of my ADODB connection object
used to connect with the external database:

dim mConn as ADODB.connection
Set mConn = New ADODB.Connection

With mConn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Properties("Jet OLEDB:System Database") = varWrkGrp
.ConnectionString = "data source=" & varDbPath & _
";User ID=" & varUser & _
";Password=" & varPwd
End With
With regards to the make-table sql, it is written as follows:

Dim sql As String
sql = "SELECT prodID, prodName, prodCtgy " & _
"INTO tTemp IN " & varLocalDbPath & _
"FROM tProd " & _
"WHERE prodCtgy=6"
varLocalDbPath denotes the path of the front-end .mdb file, which this
code is run on.

tProd table resides on the external, user-level, secured Access

I get an error when executing the above sql because the front-end was
opened with the default system.mdw workgroup. I guess I could remedy
this by using a short-cut to open the front-end so that the it is
opened with the same workgroup as the back-end--which I tried and the
code worked.

I'm trying to alternatively program the front-end, using the default
system.mdw file, so that its access to the back-end is encapsulated in
VBA code. The problem I'm running into is this make-table sql I'm
trying to creeate.

Is there a work around to this problem without me resorting to having
the front-end opened with the same workgroup as the back-end?


Jun 6 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.