473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

I need a folder browser to backup database

I'd like a button on my main form to backup the database. How can I call up
the Windows folder browser to prompt me for a filename and type (*.mdb) and
folder to save in? I looked in my book and didn't see anything like that.
I only want to backup the data tables in the back-end database. Is there
some standard set of code to do this?

Thanks, Rich Hollenbeck
Nov 13 '05 #1
6 1658
See http://www.mvps.org/access/api/api0001.htm at "The Access Web

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:nUyfd.3856$jD4.3074@trnddc06...
I'd like a button on my main form to backup the database. How can I call up the Windows folder browser to prompt me for a filename and type (*.mdb) and folder to save in? I looked in my book and didn't see anything like that.
I only want to backup the data tables in the back-end database. Is there
some standard set of code to do this?

Thanks, Rich Hollenbeck

Nov 13 '05 #2
Thanks, Doug. You pointed my in the right direction but I suspect that
http://www.mvps.org/access/api/api0026.htm may be a little closer to what
I'm looking for. I copied the module into the clipboard then pasted it into
a new module I called, "basFMakeBackup."

inside the command button's code I simply typed fMakeBackup(). I got the
error, "Expected ="
I don't know how to use this. I tried currentDB = fMakeBackup. I got the
error, "Invalid use of property."

Unfortunately, this apparently excellent little module didn't come with any
explanation. I guess the idea is that if I don't know enough to figure it
out by myself, I probably shouldn't use it. I won't sit around and wait for
a reply but I'll continue trying to figure it out. But if you choose to
reply with a hint about how this module works, I thank you in advance!
Thank you!

Also, I would like to modify it to build a string based on now() (for
example, "20041027_backup.mdb") and append that to the new file name instead
of just "Copy of (?)" That way all backups will automatically have a name
that reflects the date and will automatically be sorted by date.

Rich Hollenbeck

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:Nd********************@rogers.com...
See http://www.mvps.org/access/api/api0001.htm at "The Access Web

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:nUyfd.3856$jD4.3074@trnddc06...
I'd like a button on my main form to backup the database. How can I call
up
the Windows folder browser to prompt me for a filename and type (*.mdb)

and
folder to save in? I looked in my book and didn't see anything like

that. I only want to backup the data tables in the back-end database. Is there some standard set of code to do this?

Thanks, Rich Hollenbeck


Nov 13 '05 #3
An example I'm working on to change the file name of the resulting backup
file goes like this:

Private Sub cmdBackupDatabase_Click()
Dim datVarDate
Dim datDate As Date
Dim strNewFileName As String

datDate = Now()
strNewFileName = year(datDate) & Month(datDate) & Day(datDate) &
"Backup.mdb"
'Results in something like, "20041027Backup.mdb" -- this part works.
End Sub

Now I need to figure out how to modify the fMakeBackup() module (found at
http://www.mvps.org/access/api/api0026.htm) to make this change, and then
how to use the module.

"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:riRfd.5208$8R.2554@trnddc02...
Thanks, Doug. You pointed my in the right direction but I suspect that
http://www.mvps.org/access/api/api0026.htm may be a little closer to what
I'm looking for. I copied the module into the clipboard then pasted it into a new module I called, "basFMakeBackup."

inside the command button's code I simply typed fMakeBackup(). I got the
error, "Expected ="
I don't know how to use this. I tried currentDB = fMakeBackup. I got the
error, "Invalid use of property."

Unfortunately, this apparently excellent little module didn't come with any explanation. I guess the idea is that if I don't know enough to figure it
out by myself, I probably shouldn't use it. I won't sit around and wait for a reply but I'll continue trying to figure it out. But if you choose to
reply with a hint about how this module works, I thank you in advance!
Thank you!

Also, I would like to modify it to build a string based on now() (for
example, "20041027_backup.mdb") and append that to the new file name instead of just "Copy of (?)" That way all backups will automatically have a name
that reflects the date and will automatically be sorted by date.

Rich Hollenbeck

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:Nd********************@rogers.com...
See http://www.mvps.org/access/api/api0001.htm at "The Access Web

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:nUyfd.3856$jD4.3074@trnddc06...
I'd like a button on my main form to backup the database. How can I call
up
the Windows folder browser to prompt me for a filename and type
(*.mdb) and
folder to save in? I looked in my book and didn't see anything like

that. I only want to backup the data tables in the back-end database. Is there some standard set of code to do this?

Thanks, Rich Hollenbeck



Nov 13 '05 #4
The function returns a Boolean value (True if successful, False otherwise).
You have a few options.

One is to assign the results of the database to a variable:

Dim booReturn As Boolean

booReturn = fMakeBackup()

Another is simply to check the value that's returned in an If statement:

If fMakeBackup() Then
MsgBox "Backup Successful"
Else
MsgBox "Backup Failed"
End If

A third is to use the Call verb:

Call fMakeBackup

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:riRfd.5208$8R.2554@trnddc02...
Thanks, Doug. You pointed my in the right direction but I suspect that
http://www.mvps.org/access/api/api0026.htm may be a little closer to what
I'm looking for. I copied the module into the clipboard then pasted it into a new module I called, "basFMakeBackup."

inside the command button's code I simply typed fMakeBackup(). I got the
error, "Expected ="
I don't know how to use this. I tried currentDB = fMakeBackup. I got the
error, "Invalid use of property."

Unfortunately, this apparently excellent little module didn't come with any explanation. I guess the idea is that if I don't know enough to figure it
out by myself, I probably shouldn't use it. I won't sit around and wait for a reply but I'll continue trying to figure it out. But if you choose to
reply with a hint about how this module works, I thank you in advance!
Thank you!

Also, I would like to modify it to build a string based on now() (for
example, "20041027_backup.mdb") and append that to the new file name instead of just "Copy of (?)" That way all backups will automatically have a name
that reflects the date and will automatically be sorted by date.

Rich Hollenbeck

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:Nd********************@rogers.com...
See http://www.mvps.org/access/api/api0001.htm at "The Access Web

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:nUyfd.3856$jD4.3074@trnddc06...
I'd like a button on my main form to backup the database. How can I call
up
the Windows folder browser to prompt me for a filename and type
(*.mdb) and
folder to save in? I looked in my book and didn't see anything like

that. I only want to backup the data tables in the back-end database. Is there some standard set of code to do this?

Thanks, Rich Hollenbeck



Nov 13 '05 #5
Hats off to you! I appreciate all the help you give to all of us. It
works, but I want to backup the back-end file (where all the data is.) I
guess I'll put the module in that database and run it automatically once a
week(or every day deleting older copies.)

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:9O********************@rogers.com...
The function returns a Boolean value (True if successful, False otherwise). You have a few options.

One is to assign the results of the database to a variable:

Dim booReturn As Boolean

booReturn = fMakeBackup()

Another is simply to check the value that's returned in an If statement:

If fMakeBackup() Then
MsgBox "Backup Successful"
Else
MsgBox "Backup Failed"
End If

A third is to use the Call verb:

Call fMakeBackup

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:riRfd.5208$8R.2554@trnddc02...
Thanks, Doug. You pointed my in the right direction but I suspect that
http://www.mvps.org/access/api/api0026.htm may be a little closer to what
I'm looking for. I copied the module into the clipboard then pasted it

into
a new module I called, "basFMakeBackup."

inside the command button's code I simply typed fMakeBackup(). I got the
error, "Expected ="
I don't know how to use this. I tried currentDB = fMakeBackup. I got the error, "Invalid use of property."

Unfortunately, this apparently excellent little module didn't come with

any
explanation. I guess the idea is that if I don't know enough to figure it out by myself, I probably shouldn't use it. I won't sit around and wait

for
a reply but I'll continue trying to figure it out. But if you choose to
reply with a hint about how this module works, I thank you in advance!
Thank you!

Also, I would like to modify it to build a string based on now() (for
example, "20041027_backup.mdb") and append that to the new file name

instead
of just "Copy of (?)" That way all backups will automatically have a name that reflects the date and will automatically be sorted by date.

Rich Hollenbeck

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:Nd********************@rogers.com...
See http://www.mvps.org/access/api/api0001.htm at "The Access Web

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:nUyfd.3856$jD4.3074@trnddc06...
> I'd like a button on my main form to backup the database. How can I

call
up
> the Windows folder browser to prompt me for a filename and type

(*.mdb) and
> folder to save in? I looked in my book and didn't see anything like

that.
> I only want to backup the data tables in the back-end database. Is

there
> some standard set of code to do this?
>
> Thanks, Rich Hollenbeck
>
>



Nov 13 '05 #6
Hi Dennis,

I solved the date string thing something like this:

Private Sub cmdBackupDatabase_Click()
Dim datDate As Date
Dim strNewFileName As String
datDate = Now()
strNewFileName=year(datDate)&Month(datDate)&Day(da tDate)&"Backup.mdb"
'Results in something like, "20041027Backup.mdb" -- this part works.
End Sub

Now I just need to get this little snippet of code into the fMakeBackup
module, instead of in my backup subroutine.

I got the module to work okay by putting it in a select case and a boolean
case 1 and case 0 thing with a message box. It worked fine. I just don't
like the "copy of (?)" stuff.
"Dennis Lee Bieber" <wl*****@ix.netcom.com> wrote in message
news:mt********************************@4ax.com...
On Wed, 27 Oct 2004 17:55:35 GMT, "Richard Hollenbeck"
<ri****************@verizon.net> declaimed the following in
comp.databases.ms-access:


inside the command button's code I simply typed fMakeBackup(). I got the
error, "Expected ="
I don't know how to use this. I tried currentDB = fMakeBackup. I got the error, "Invalid use of property."

From the web page:

Function fMakeBackup() As Boolean

fMakeBackup returns a Boolean status code

status = fMakeBackup()

would be a usage, though I don't know how to make use of a return value
from a command button.

Also, I would like to modify it to build a string based on now() (for
example, "20041027_backup.mdb") and append that to the new file name instead of just "Copy of (?)" That way all backups will automatically have a name that reflects the date and will automatically be sorted by date.

lngFlags = FOF_SIMPLEPROGRESS Or _
FOF_FILESONLY Or _
FOF_RENAMEONCOLLISION
strSaveFile = CurrentDb.Name

Guessing, but...

Remove the
Or _
FOF_RENAMECONCOLLISION

which flag probably is what causes the "Copy (n) of " file name.

Then something to the effect of (you'll have to check for
options to make now() a string)

strSaveFile = CurrentDb.Name & now() & "_backup.mdb"

possibly with a Left$(CurrentDb.Name, len(CurrentDb.Name) - 4) if you
need to remove a pre-existing ".mdb"
--
> ================================================== ============ <
> wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wu******@dm.net | Bestiaria Support Staff <
> ================================================== ============ <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <

Nov 13 '05 #7

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

Similar topics

13
by: jenny | last post by:
Hi, I am trying to find a VB way that would create a folder on all existing drives - the folder name would be the same on each drive. ie c:\backup, d:\backup, etc. But the folders would only be...
2
by: nt | last post by:
I am having a problem with a regular backup of an SQL Server (MSDE 2000) database to a local drive. I initiate the backup once a week, by issuing the required T-SQL, via ADO. In this case, the...
236
by: Andrew Rawnsley | last post by:
Anyone out there using beta 2 in production situations? Comments on stability? I am rolling out a project in the next 4 weeks, and really don't want to go though an upgrade soon after its released...
1
by: alex | last post by:
Hi ! I couldn't make backups with our new system using db2 8.2. Every time I trigger a backup I get this error message: BACKUP DATABASE EBUERO2 ONLINE TO "/raid/backup/ebuero2/part1",...
2
by: db2group88 | last post by:
we are using db2 udb v8.2 Express edition on windows 2003,we use third party vendor software to help replicate one server to another. Production server has three instances, each instances has one...
3
by: ChrisWinterscheid | last post by:
We are running DB2 8.1 on AIX 5.2. DB2level shows: DB21085I Instance "db2inst1" uses "32" bits and DB2 code release "SQL08016" with level identifier "02070106". Informational tokens are "DB2...
5
by: HSP | last post by:
hi. i need to restore an old database. The db was backed up using a DLT drive, using 2 volumes. The content for the tapes was copied to file onto Solaris machine using rsh and dd (for backup...
5
by: smoi | last post by:
Hi all, My manager ask me to do backup for 3 database and restore them in a new server. I did the backup for the 3 database into BAK file. Then in the new server, when I did the restore in SQL...
8
by: Tamer Ibrahim | last post by:
Hi, Can I backup & restore my sql server database from aspx page located on a client machine ? Thank You.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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,...
0
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...

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.