By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,871 Members | 2,595 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,871 IT Pros & Developers. It's quick & easy.

I need a folder browser to backup database

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.