472,954 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 software developers and data experts.

VBScript import data table Employee using odbc connection and save as msaccess data

I got few odbc connections, where I can import tables from in Access,

However, I'm trying to create a vb Script, which uses the exisitng odbc DSN connection and import or read a table and save that table in my network path as MS ACCESS .mdb format:


Expand|Select|Wrap|Line Numbers
  1. Set MyConn = Server.CreateObject("ADODB.Connection")
  2.     MdbFilePath = Server.MapPath("abc")
  3.     MyConn.Open "Driver={xyz 32bit Driver }; 
  4. DBQ=" & MdbFilePath & ";"
  5.  
  6. SQL_query = "SELECT * from table1"
  7.  
  8.     Set RS = MyConn.Execute(SQL_query)
  9.     WHILE NOT RS.EOF
  10.     RS.MoveNext
  11.     WEND
  12.  
  13.     RS.Close
  14.     set RS = nothing  
  15.     MyConn.close
  16.     set MyConn = nothing
Aug 28 '16 #1
1 1297
zmbd
5,501 Expert Mod 4TB
1) Is this really VBScript or VBA?

2) the MDB format is basically depreciated, are you sure you want to store information in a format that may be discontinued sometime in the near future, MS has already yanked support for legacy thru ACC97-MDB files!

3) One way to do this in VBA would be to add a new database to the workspace then use a make-table action query against this new database against the open recordset or perhaps the DoCmd.TransferDatabase depending on the nature of your application. A potentially faster method after creating a second database and setting up the table(s) might be the SELECT.INTO Statement (Microsoft Access SQL) (syntax)) (personally I never build the SQL string in the function as shown in the example, makes it impossible to properly troubleshoot) and the execute method; however, I'm not sure if this will work as you've not included any details about your data source.

Lots of options here...
Sep 6 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jeff D. Hamann | last post by:
Sorry for the seemingly novice posting, but I could find a solution for this on the web so far... I've been developing a database using postgresql (and loving it) and have started running into...
0
by: Pep | last post by:
Hi, I have to access a Faircom database using ODBC and am having problems with a query run from visual studio 2005. I can run the floowing query in MSAccess with no problem SELECT ...
0
by: pmaers | last post by:
I need a source code in Visual Basic .Net regarding about updating data records using MS Access database (.MDB).
0
by: Sonu joshi | last post by:
hi i m looking for an example of lotus script agent , which will connect to db2 using odbc connection . Hope to see an example from you guys very soon. thanx in advance.
0
by: bbeshlian | last post by:
I was given the code to intially develop an interface for a web based system I will eventually administer. I tested the code and I can write my SQL statements to retrieve and display the data I...
1
by: WeCi2i | last post by:
Okay, I have a problem that has been stumping me for weeks. I have tried many different solutions and this is pretty much my last resort. I have seen a lot of good answers give here so I figured I...
9
by: sathikbasha | last post by:
hi Please help me !!!!!!! how to connect the Tally from VB. Is there any ODBC connection in Tally Software. I need to import the data from SQL Server to Tally. regards
3
by: nico3334 | last post by:
I'm filling in a Report with SQL data using VB code. I'm using LOOP and MoveNext. Before using MoveNext, I would like to be able to check whether the new data is equal to the previous data that was...
0
by: Winsly Jucar | last post by:
I want to create a program that collects data inputed by user on a webpage form, then saves it to a database located at the user's pc. My problem is: 1. is it possible to collect data from a...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.