473,804 Members | 3,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Backing Up Ones SQL-Server Data as Jet

I have a tiny db on a remote sql server. The owner of the sever backs up the
db daily, but these backups are not freely available to me. I want my data
(only my data) backed up in some form that is accessible to me.

I have an adp. It exists only to connect to the remote db.
I have an mdb. It has a form. The form opens on the db’s opening. This is the
code behind the form. It zaps any tables in the mdb. It examines the tables
in the adp. It imports them. It copies them to a backup device. It closes the
db and the access application.

I have not tried this with any medium or large sized db, only with a tiny db.
I expect it would take too long with a larger db; for a few tables and a few
hundred records it takes about 11 seconds.

I open the db through Windows scheduling every Sunday at 04:00, os even if it
took an hour I would not be inconvenienced. It has worked without incident
for several weeks now. I could modify it to back up SPROCs, VIEWs and
FUNCTIONs but I don’t need that.

So, it gives me my data in JET, without intervention.
(Gee, I hope I haven't posted this before, but I think not.)
Option Compare Database
Option Explicit
Const ADPFile As String = "F:\Access\Some Books.adp"
Const Backupfile As String = "E:\SomeBooks.m db"

Const b As String = "PROVIDER=SQLOL EDB.1;" _
& "PERSIST SECURITY INFO=FALSE;" _
& "INITIAL CATALOG=DB_A0A0 A0;" _
& "DATA SOURCE=Some.Rem ote.SQL.Server"
Const p As String = "X9X9X9"
Const u As String = "UserName"

Private Sub BackupSQLTables AsJET()
Dim c As ADODB.Connectio n
Dim r As ADODB.Recordset

' zap old tables
Set c = New ADODB.Connectio n
With c
.Open CurrentProject. BaseConnectionS tring
End With
' get table names
Set r = c.OpenSchema( _
adSchemaTables, Array(Empty, Empty, Empty, "Table"))
With r
Do While Not .EOF
CurrentProject. Connection.Exec ute ("DROP TABLE " & !TABLE_NAME)
.MoveNext
Loop
End With

' refresh TableDefs
DBEngine(0)(0). TableDefs.Refre sh

' set persist security information
' in the adp file to true
SecurityInforma tion "TRUE"

' connect to the ADP file
With c
.Close
.Open b & ";USER ID=" & u & ";PASSWORD= " & p
End With

' get table names
Set r = c.OpenSchema( _
adSchemaTables, Array(Empty, Empty, Empty, "Table"))

' import the SQL tables (as JET)
With r
Do While Not .EOF
If Left(!TABLE_NAM E, 2) <> "dt" Then _
DoCmd.TransferD atabase acImport, "Microsoft Access", _
ADPFile, acTable, !TABLE_NAME, !TABLE_NAME, False
.MoveNext
Loop
.Close
End With

' set persist security information
' in the adp file to false
SecurityInforma tion "FALSE"

' copy the tables to the BackUp Device
SaveAsText 6, "", Backupfile

DoCmd.Close acForm, Me.Name

End Sub

Private Sub Form_Close()
Application.Qui t
End Sub

Private Sub Form_Open(Cance l As Integer)
BackupSQLTables AsJET
End Sub

Private Sub SecurityInforma tion(ByVal vPERSIST As String)
Dim a As Access.Applicat ion
Set a = New Access.Applicat ion
With a
.OpenAccessProj ect ADPFile
With .CurrentProject
If .IsConnected Then .CloseConnectio n
.OpenConnection Replace(b, "FALSE", vPERSIST), u, p
End With
.Quit
End With
End Sub

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05
10 1732
Lyle Fairfield <Mi************ @Invalid.Com> wrote:
FWIW you could download MSDE (sorta SQL Server lite) for free. Or
purchase the SQL Server Developer Tools for $50.

And your point is?


If you wanted to copy your data to SQL Server or work on the software on
your own system with exactly the same environment.


And you thought I was using ADPs but was unaware of MSDE, SQL and DTS?


Yup, you're right. I had missed that when I had replied and hadn't thought things
through.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #11

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

Similar topics

2
1313
by: Eric | last post by:
I've taken a look at mysqlhotcopy and mysqldump but neither seem to do what I need them to do which is to backup only the data which has changed since the last backup. Is there a way to do this? Of course, being able to recover the database from these delta backups is important.
9
1587
by: J. Frank Parnell | last post by:
hello, i dont know asp at all, but i have been asked to backup a database that is used on a site which uses .aspx. i dont need to do anything with it, just copy it and send it along to someone who will. I have the IP, username, password. i have allready got all the files off the site with ftp, is the database in there? i dont really even know what i'm looking for, but i dont see any .mdb or .sql right off the bat.
9
1597
by: Jerry Porter | last post by:
Is there a way to back up the design changes in a SQL Server database without backing up all the data? It's just test data at this point.
3
1590
by: war_wheelan | last post by:
I am having a problem backing up my database and TLog files due to a lack of local diskspace. The db file is about 30GB and the TLog is about 20GB each on a different hard disk. Each disk doesn't have enough available space to accomadate a backup. I also can't shrink the files because part of that procedure would require a backup. Question: Can I use a redirected drive for the backup media? Is there a way to trick SQL into allowing...
5
1507
by: Stewart Graefner | last post by:
I would like to know if an Access db can be backed up with the push of a command button. I work with extreamly lazy operators who despite crashing their db's still refuse to see the value in backing up their db's. Fools them..but its me that has to undo the boondogal. I would like to be able to put a buttom on the form which will send the a copy of the db to another drive, perhaps a USB stick. Any ideas? *** Sent via Developersdex...
1
1495
by: Martin Schmid | last post by:
I am developing using Visual C#.net. It appears that my web projects create files in both "My Documents\Visual Studio Projects" and ".\inetpub\webroot". Does backing up these files ensure that my code is all backed up? Is there a backup/restore FAQ somewhere? -- Thanks, Martin Schmid, EIT, CCSA, MCDBA, MCSE
0
986
by: Martin Schmid | last post by:
I am developing using Visual C#.net. It appears that my web projects create files in both "My Documents\Visual Studio Projects" and ".\inetpub\webroot". Does backing up these files ensure that my code is all backed up? Is there a backup/restore FAQ somewhere? -- Thanks, Martin Schmid, EIT, CCSA, MCDBA, MCSE
5
1806
by: rdemyan via AccessMonster.com | last post by:
I have code in my front end that opens a form for backing up the front end. I'll give a brief description of what the form does: 1) When the backup form opens, it closes all open forms except for three hidden forms and the backup form itself. 2) It automatically creates a backup name for the front end and displays the folder where it will be backed up. 3) The user clicks the backup button and the following code executes:
9
1114
by: jim | last post by:
I'd like to get some .net sample code that shows me how to make a complete backup of a hard drive (like my C: drive) to another location (say my D: drive) while the C: drive is in use. Basically, I'd like to make and give away free backup software because Acronis has given me so many problems. Any help or links you could provide would be greatly appreciated. (Please include your name to be added to the credits screen in the free...
4
3827
by: Joerg Battermann | last post by:
Hello there, does anyone know the precise naming conventions used for internal backing fields for automatic properties? Something official besides looking at the compiled assemblies that might let you 'assume' a certain schema... Cheers and thanks, -jB
0
9706
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
10577
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10077
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
9150
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...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.