473,657 Members | 2,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make local copy of backend table - how?

I wish to copy a table on a SQL Server backend to a table on an Access
(.mdb) front end in the simplest way.

I have the following to get the recordset but am seeking something
easier.

Dim theConnectionSt ring
theConnectionSt ring = "Driver=SQL Server;
Server=Server;D atabase=myData; Trusted_Connect ion=Yes"

Dim rec As ADODB.Recordset
Set rec = New ADODB.Recordset

Dim theSQLString
theSQLString = "Select * From backEndTable"

rec.Open theSQLString, theConnectionSt ring, adOpenStatic,
adLockOptimisti c

Do Until rec.EOF
' copy each record to the frontEndTable, field by field
rec.MoveNext
Loop

This will work but I want to be able to copy from the back end to the
front end in a simpler way. Either some SQL on the backend which can
copy directly to the frontend; but I do not know how to specify the
frontend table in a way that the backend understands.

Alternatively, having got the recordset, I would like to copy all of it
to the frontend table in a single statement without having to loop
through the records. Something like "copy the recordset 'rec' to
the table 'frontEndTable' "

Are either of these possible? If so, how?

Dec 14 '06 #1
4 4966
Link the SQL Server table.

Create a Make Table query.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jim Devenish" <in************ ***@foobox.comw rote in message
news:11******** *************@n 67g2000cwd.goog legroups.com...
>I wish to copy a table on a SQL Server backend to a table on an Access
(.mdb) front end in the simplest way.

I have the following to get the recordset but am seeking something
easier.

Dim theConnectionSt ring
theConnectionSt ring = "Driver=SQL Server;
Server=Server;D atabase=myData; Trusted_Connect ion=Yes"

Dim rec As ADODB.Recordset
Set rec = New ADODB.Recordset

Dim theSQLString
theSQLString = "Select * From backEndTable"

rec.Open theSQLString, theConnectionSt ring, adOpenStatic,
adLockOptimisti c

Do Until rec.EOF
' copy each record to the frontEndTable, field by field
rec.MoveNext
Loop

This will work but I want to be able to copy from the back end to the
front end in a simpler way. Either some SQL on the backend which can
copy directly to the frontend; but I do not know how to specify the
frontend table in a way that the backend understands.

Alternatively, having got the recordset, I would like to copy all of it
to the frontend table in a single statement without having to loop
through the records. Something like "copy the recordset 'rec' to
the table 'frontEndTable' "

Are either of these possible? If so, how?

Dec 14 '06 #2
"Jim Devenish" <in************ ***@foobox.comw rote in message
news:11******** *************@n 67g2000cwd.goog legroups.com...
>I wish to copy a table on a SQL Server backend to a table on an Access
(.mdb) front end in the simplest way.
Alternatively, having got the recordset, I would like to copy all of it
to the frontend table in a single statement without having to loop
through the records. Something like "copy the recordset 'rec' to
the table 'frontEndTable' "

Are either of these possible? If so, how?
How about a make-table query? Or am I missing the point?

Keith.
www.keithwilby.com
Dec 14 '06 #3
Jim Devenish wrote:
I wish to copy a table on a SQL Server backend to a table on an Access
(.mdb) front end in the simplest way.
Older ways include:

Create a sister ADP file connected to the SQL db. Then (from the MDB):
DoCmd.TransferD atabase acImport, "Microsoft Access", _
ADPFile, acTable, TABLE_NAME, TABLE_NAME, False
-
Create an ODBC link: Then
DoCmd.TransferD atabase acLink, "ODBC Database", _
"ODBC;DSN=DataS ource1;UID=User 2;PWD=www;LANGU AGE=us_english; " _
& "DATABASE=pubs" , acTable, "Authors", "dboAuthors "
-
Create a specific non-DSN odbc link to the table:
Sub adub()

Dim connect$
Dim tdf As DAO.TableDef
Dim db As DAO.Database

strConnect = "ODBC;DRIVER={S QL Server}" _
& ";SERVER=______ ____" _
& ";DATABASE=____ ______" _
& ";UID=_________ _" _
& ";PWD=_________ _"

Set db = CurrentDb()
Set tdf = db.CreateTableD ef("LocalFFDBAA ccounts")
tdf.SourceTable Name = "FFDBAAccou nts"

tdf.connect = connect

db.TableDefs.Ap pend tdf
db.TableDefs.Re fresh

End Sub

Then use the table or just copy it and then remove the link.

--
.... there may be newer ways; if there are we can hope someone will tell
us.

Dec 14 '06 #4
I was trying to do it without linking to the backend table. Since I
can access the backend table without a link, I was hoping to make a
copy as well.

But thanks anyway. I will try it with a link

Jim

Allen Browne wrote:
Link the SQL Server table.

Create a Make Table query.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jim Devenish" <in************ ***@foobox.comw rote in message
news:11******** *************@n 67g2000cwd.goog legroups.com...
I wish to copy a table on a SQL Server backend to a table on an Access
(.mdb) front end in the simplest way.

I have the following to get the recordset but am seeking something
easier.

Dim theConnectionSt ring
theConnectionSt ring = "Driver=SQL Server;
Server=Server;D atabase=myData; Trusted_Connect ion=Yes"

Dim rec As ADODB.Recordset
Set rec = New ADODB.Recordset

Dim theSQLString
theSQLString = "Select * From backEndTable"

rec.Open theSQLString, theConnectionSt ring, adOpenStatic,
adLockOptimisti c

Do Until rec.EOF
' copy each record to the frontEndTable, field by field
rec.MoveNext
Loop

This will work but I want to be able to copy from the back end to the
front end in a simpler way. Either some SQL on the backend which can
copy directly to the frontend; but I do not know how to specify the
frontend table in a way that the backend understands.

Alternatively, having got the recordset, I would like to copy all of it
to the frontend table in a single statement without having to loop
through the records. Something like "copy the recordset 'rec' to
the table 'frontEndTable' "

Are either of these possible? If so, how?
Dec 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
11410
by: MAB71 | last post by:
There should be a way to copy an access database ( .mdb file ) without closing connections to it. Unfortunately the FileCopy statement in VB gives an error if users are connected to the db. But I can copy the file using windows explorer so there must be a way. WinAPI function or something? I'm using VB6 and Access 2000
7
2369
by: nydiroth | last post by:
Our servers went down for over 6 hours yesterday and I was asked if there was a way to store the database on the server and a local station at the same time. My datbase is split and the tables are linked. Would there be a way to modify the table links to direct them to two seperate backends? Could there also be a non-linked table stored in the frontend alongside the table links? Our endpoint would be to have a mirror on the network...
1
5604
by: Knepper, Michelle | last post by:
Hi out there, I'm a first-time user of the "Copy ... From..." command, and I'm trying to load a table from a text flat file. http://www.postgresql.org/docs/7.4/static/sql-copy.html I don't know if I'm using the command correctly. Question: I run this command as a superuser, and the "copy from" command is run like a SQL command on the command line, correct?
6
4866
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
3
4558
by: LurfysMa | last post by:
I would like to hear opinions on the tradeoffs of putting the tables, forms, and queries for several related datasets in separate databases vs one combined database. I am working on an application that will have a number of "subjects". The subjects have a number of commonalities, but are not identical. I am hoping that I will discover that the subjects fall into a few "types" and a common database structure can be used for each type. ...
10
7688
by: Jim Devenish | last post by:
I have a split front end/back end system. However I create a number of local tables to carry out certain operations. There is a tendency for the front end to bloat so I have set 'compact on close' I think that I have read in some threads (althoug I cannot find them now) that others place such tables in a local, linked database. I could do this but I am interested to know what would be the advantages. And disadvantages, if any. Any...
0
1380
by: M Cavanagh | last post by:
I am fairly new using functions to return file info and I made an assumption that a function working on a local machine would work fine on a server. I have searched several Access books to find a how one can use reference a relative path in an application. I found a function in Access Dev Handbook which in fact returns a relative path but not (apparently) for a file on a server share. I tested the function and it works fine on a local...
7
2713
by: ShyGuy | last post by:
Is ther a way to copy a table, from the backend of a split database, into a database on another machine from the front end?
3
2010
by: salad | last post by:
I have an A97 application that is NOT split on a network. It is used by 15+ folks continually. It is quick and fast. I split it several years ago and had to merge it together again after the folks rebelled at the slow speed resulting from the split. I have to bite the bullet and split it now. Of course, it is much slower. In one form that opens as a continous form, the data looks like it is being repainted as it displays...you can...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.