473,788 Members | 2,988 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing to CD from within A2003 VBA

One of my clients is going to move to CD or DVD as a medium to
backup/transfer data. Is it possible for an A2003 application to write
directly to a CD or DVD under Win XP, or will I need to set up an
external script?

TIA,

Bruce

Nov 13 '05 #1
2 1486
This worked for AK2. Gave a choice of backing up to floppy or CD.
There are 2 tables, 1 called "Paths" designating the name of the file to be
backed up (Data Mdb), the zip file wich is irrelevant for CD backup, and
whether to back up on Floppy or CD.
The other table "Backups" recorded when the backup was made etc

HTH

Phil

Function Backup(DataPath As String, ZipPath As String, BackupType As Byte)

Dim MyDb As Database
Dim PathSet As Recordset, BackupSet As Recordset
Dim ZipProgPath As String ' path for WZZip
(Winzip)
Dim CDBackupPath As String, BackupFolder As String ' Folder for the CD
backup
Dim fs As Object
Dim File
Dim Msg As String

On Error GoTo BackupData_Err

Set MyDb = CurrentDb
Set PathSet = MyDb.OpenRecord set("Paths")
If IsNull(PathSet! ZipProgPath) Then
MsgBox "There is no program designated for the Floppy Zip program",
vbCritical, "Insufficie nt Detail"
Exit Function
End If
ZipProgPath = PathSet!ZipProg Path ' Name of Zip
Program
CDBackupPath = PathSet!CDBacku pPath ' Folder for the CD
backup
PathSet.Close
Set PathSet = Nothing

If BackUpMedia = 1 Then
GoTo FloppyBackup
End If

If BackUpMedia = 2 Then
GoTo CDBackup
End If

FloppyBackup:
Set fs = CreateObject("S cripting.FileSy stemObject")
If Dir(ZipPath) <> "" Then ' Make sure that the zipped data
file exists
fs.deletefile ZipPath
End If

'run Winzip approzimately 60% compression
ShellWait (ZipProgPath & " " & Chr$(34) & ZipPath & Chr$(34) & " " &
Chr$(34) & DataPath & Chr$(34)), vbNormalFocus

CheckDirectory:

If Dir(ZipPath) <> "" Then ' Make sure that the zipdata file
exists
fs.Copyfile ZipPath, "A:/", True ' Copy Data to AMM Services
Data.Bak
GoTo UpdateBackupTab le
Else
If MsgBox("Can't find the Zipped " & DataPath & " File", vbCritical
+ vbRetryCancel) = vbRetry Then
GoTo CheckDirectory
Else
Exit Function
End If
End If

CDBackup:
Set fs = CreateObject("S cripting.FileSy stemObject")
If CDBackupPath = "" Then
MsgBox "There is no path set for the CD backup", vbCritical,
"Insufficie nt Detail"
Exit Function
End If
If Dir(DataPath) <> "" Then ' Make sure that the
data file exists
If Dir(CDBackupPat h) = "" Then ' CD File not found
Msg = "Can't find the " & CDBackupPath & " File on the CD" &
Chr$(13)
Msg = Msg & " Do you want to create this file yourself?"
If MsgBox(Msg, vbQuestion + vbYesNo, "Missing CD File") = vbNo
Then
Exit Function
Else
BackupFolder = Left$(CDBackupP ath, (InStrRev(CDBac kupPath,
"\") - 1))
fs.createfolder (BackupFolder)
End If
End If
fs.Copyfile DataPath, CDBackupPath, True ' Copy Data to AMM
Services Data.Bak
GoTo UpdateBackupTab le
Else
MsgBox "Can't find the " & DataPath & " File", vbCritical
Exit Function
End If

UpdateBackupTab le:
Set BackupSet = MyDb.OpenRecord set("Backups") ' Open Backups table
' Table exists

Set File = fs.Getfile(CDBa ckupPath)

With BackupSet
.AddNew
!BackupDate = Now()
!BackupType = BackupType
!BackUpMedia = BackUpMedia ' 1 - Floppy,
2 - CD
!BackUpSize = File.Size
.Update
.Close
End With

MsgBox "Backup Completed Successfully", vbInformation, "Backup Data"
ReturnValue = SysCmd(acSysCmd ClearStatus)
Exit Function

BackupData_Err:
ReturnValue = SysCmd(acSysCmd ClearStatus)
If Err = 52 Then
If BackUpMedia = 2 Then
MsgBox "There is no CD in the Drive", vbCritical
End If
Exit Function
End If

If Err = 76 Then
If BackUpMedia = 1 Then
MsgBox "There is no Floppy Disk in the Drive", vbCritical
Else
MsgBox "The required directory is not on the CD", vbCritical
End If
Exit Function
End If
If Err = -2147024784 Then
If BackUpMedia = 1 Then
MsgBox "The Floppy Disk is full", vbCritical
Else
MsgBox "The CD is full", vbCritical
End If
Exit Function
End If
MsgBox Err.Description
End Function
"Bruce Dodds" <br********@com cast.net> wrote in message
news:htdGc.2862 2$Oq2.23740@att bi_s52...
One of my clients is going to move to CD or DVD as a medium to
backup/transfer data. Is it possible for an A2003 application to write
directly to a CD or DVD under Win XP, or will I need to set up an
external script?

TIA,

Bruce

Nov 13 '05 #2
Phil Stanton wrote:
This worked for AK2. Gave a choice of backing up to floppy or CD.
There are 2 tables, 1 called "Paths" designating the name of the file to be
backed up (Data Mdb), the zip file wich is irrelevant for CD backup, and
whether to back up on Floppy or CD.
The other table "Backups" recorded when the backup was made etc

HTH

Phil

Function Backup(DataPath As String, ZipPath As String, BackupType As Byte)

Dim MyDb As Database
Dim PathSet As Recordset, BackupSet As Recordset
Dim ZipProgPath As String ' path for WZZip
(Winzip)
Dim CDBackupPath As String, BackupFolder As String ' Folder for the CD
backup
Dim fs As Object
Dim File
Dim Msg As String

On Error GoTo BackupData_Err

Set MyDb = CurrentDb
Set PathSet = MyDb.OpenRecord set("Paths")
If IsNull(PathSet! ZipProgPath) Then
MsgBox "There is no program designated for the Floppy Zip program",
vbCritical, "Insufficie nt Detail"
Exit Function
End If
ZipProgPath = PathSet!ZipProg Path ' Name of Zip
Program
CDBackupPath = PathSet!CDBacku pPath ' Folder for the CD
backup
PathSet.Close
Set PathSet = Nothing

If BackUpMedia = 1 Then
GoTo FloppyBackup
End If

If BackUpMedia = 2 Then
GoTo CDBackup
End If

FloppyBackup:
Set fs = CreateObject("S cripting.FileSy stemObject")
If Dir(ZipPath) <> "" Then ' Make sure that the zipped data
file exists
fs.deletefile ZipPath
End If

'run Winzip approzimately 60% compression
ShellWait (ZipProgPath & " " & Chr$(34) & ZipPath & Chr$(34) & " " &
Chr$(34) & DataPath & Chr$(34)), vbNormalFocus

CheckDirectory:

If Dir(ZipPath) <> "" Then ' Make sure that the zipdata file
exists
fs.Copyfile ZipPath, "A:/", True ' Copy Data to AMM Services
Data.Bak
GoTo UpdateBackupTab le
Else
If MsgBox("Can't find the Zipped " & DataPath & " File", vbCritical
+ vbRetryCancel) = vbRetry Then
GoTo CheckDirectory
Else
Exit Function
End If
End If

CDBackup:
Set fs = CreateObject("S cripting.FileSy stemObject")
If CDBackupPath = "" Then
MsgBox "There is no path set for the CD backup", vbCritical,
"Insufficie nt Detail"
Exit Function
End If
If Dir(DataPath) <> "" Then ' Make sure that the
data file exists
If Dir(CDBackupPat h) = "" Then ' CD File not found
Msg = "Can't find the " & CDBackupPath & " File on the CD" &
Chr$(13)
Msg = Msg & " Do you want to create this file yourself?"
If MsgBox(Msg, vbQuestion + vbYesNo, "Missing CD File") = vbNo
Then
Exit Function
Else
BackupFolder = Left$(CDBackupP ath, (InStrRev(CDBac kupPath,
"\") - 1))
fs.createfolder (BackupFolder)
End If
End If
fs.Copyfile DataPath, CDBackupPath, True ' Copy Data to AMM
Services Data.Bak
GoTo UpdateBackupTab le
Else
MsgBox "Can't find the " & DataPath & " File", vbCritical
Exit Function
End If

UpdateBackupTab le:
Set BackupSet = MyDb.OpenRecord set("Backups") ' Open Backups table
' Table exists

Set File = fs.Getfile(CDBa ckupPath)

With BackupSet
.AddNew
!BackupDate = Now()
!BackupType = BackupType
!BackUpMedia = BackUpMedia ' 1 - Floppy,
2 - CD
!BackUpSize = File.Size
.Update
.Close
End With

MsgBox "Backup Completed Successfully", vbInformation, "Backup Data"
ReturnValue = SysCmd(acSysCmd ClearStatus)
Exit Function

BackupData_Err:
ReturnValue = SysCmd(acSysCmd ClearStatus)
If Err = 52 Then
If BackUpMedia = 2 Then
MsgBox "There is no CD in the Drive", vbCritical
End If
Exit Function
End If

If Err = 76 Then
If BackUpMedia = 1 Then
MsgBox "There is no Floppy Disk in the Drive", vbCritical
Else
MsgBox "The required directory is not on the CD", vbCritical
End If
Exit Function
End If
If Err = -2147024784 Then
If BackUpMedia = 1 Then
MsgBox "The Floppy Disk is full", vbCritical
Else
MsgBox "The CD is full", vbCritical
End If
Exit Function
End If
MsgBox Err.Description
End Function
"Bruce Dodds" <br********@com cast.net> wrote in message
news:htdGc.2862 2$Oq2.23740@att bi_s52...
One of my clients is going to move to CD or DVD as a medium to
backup/transfer data. Is it possible for an A2003 application to write
directly to a CD or DVD under Win XP, or will I need to set up an
external script?

TIA,

Bruce


Thanks, Phil.

Nov 13 '05 #3

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

Similar topics

4
1694
by: -Michelle- | last post by:
Hi I am using A2003 on XP. The client has A2000. So I have ensured that I have developed based on A2000 and compiled as such. I have found that in a number of cases now, I have used (what I thought) was fairly standard methods & properties, but as it turns out, not so. I install on the client's machine and recompile and have found that a method is just not recognised in A2000. eg: in A2003, docmd.OpenReport includes the 'OpenArgs'...
12
2213
by: dixie | last post by:
Can someone familiar with Access 2003 please answer this question? I am asking because I don't have the use of A2003. When Access 2003 finds an Access 2000 database, does it come up with some sort of question/suggestion indicating that you can convert this datbase into the new format? I am trying to trouble shoot a remote site where a big error message indicating the database was converted using the wrong method comes up when they try to...
1
1533
by: Paul Brady | last post by:
I have A97 and A2K on my computer at home, on which I do volunteer work for several databases on our county park system. One of the clients uses A97, and the rest, A2K. The A97 user is considering upgrading their Microsoft Office. If they upgrade to Office 2000, I have no problems; I'll convert their A97 database and we'll be in business. But what if they upgrade to Office 2003 (I think there is such a thing) and install A2003. Will I...
4
1192
by: Dave G | last post by:
I have a medium sized application - data is in back end on a NT4 file server, front end on about 15 workstations. System was Access 97 on W2000 workstations and worked fine. Over Xmas upgraded all workstations to XP Pro with SP2 and Office 2003 Pro. Now I have a corruption problem. Users suddenly report very slow response, or can't find records. I do a repair on the data and then find a corrupted record in the table causing problems. I...
17
3154
by: rdemyan via AccessMonster.com | last post by:
With A2003, I'm having trouble accessing files in a folder on another computer where back-end files, update files, etc are located. Here's the scenario: 1) Computer #1 - A2003 2) Computer #2 - Access 2000; folder with back-ends for both computers and 'Update' folder. I have a launcher program that launces my application (MyApp). The launcher program also checks for updates to MyApp located in 'Update' folder (on
7
3061
by: Salad | last post by:
I am converting an application from A97 to A2003. I have 2 tables created by another application as a Foxpro.dbf. The table has no index. The connect string in A97 is FoxPro 2.0;HDR=NO;IMEX=2;DATABASE=C:\Test It's really easy to connect to those tables in A97. I'm having difficulties in A2003. I'm trying to follow the instructions in http://support.microsoft.com/kb/824264/.
1
1528
by: Fred Zuckerman | last post by:
I have a database on a shared drive. It has user level security (ie: mdw file). It was created in A2000 and works fine when opened on workstations with A2000 installed. Some workstations have A2003 installed. On those workstations there is an unbound form that continually gives the un-useful message: "Microsoft Access Has Encountered A Problem And Must Shutdown, We're Sorry For The Inconvenience"
4
1408
by: Salad | last post by:
I have A2003 split; FE on the C drive, BE on the network. There are some other people in the system. The FE app is in A2003, the backend in A97. I have an opening form; MainMenu that opens. I can go between various forms and it appears to work OK. I then click Window/Unhide and unhide the database window. I may or may not do anything in the database window. I then click back on the MainMenu form and it freezes. The command...
2
2243
by: Wayne | last post by:
I'm trying to overcome the problem that some users including myself have noticed with combo boxes in A2003 databases that are run in A2007. When the combo is tabbed out of the backstyle changes to transparent. I haven't yet seen a fix for this. If I design in A2003 now and then run the DB in A2007 in future the combo box problem may arise. What I have thought of doing is designing in A2007 and then compiling in A2003 for my current...
0
9656
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
9498
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,...
0
10364
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
10172
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
9967
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
8993
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
5398
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
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.