Results 1 to 10 of 10

Thread: Saving a database

  1. #1

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Saving a database

    I am using MS Access 2002.

    What I need to do, is when the user clicks save, it brings up a dialog box asking them what they would like to call it, and where to save it.

    I tried looking for a savefile dialogbox in VBA...but I cant seem to find it, and I am not sure I would know how to use it anyways

  2. #2

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Saving a database

    okay, I found the commondialog option...I have it opening the save menu, and only showing .mdb file extensions...but when I click save, it doesnt save anything :/

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Saving a database

    you have to tell it what to save and where to save it, using the values returned by the commondialog.

    fo save in access it should have its own save method to save the database, similar to excel or word, that will display the built in save as dialog, which works a bit different to the commondialog.

    pete

  4. #4

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Saving a database

    thanks for your help..buit that still kinda leaves me at square 1

    I tried findind the save method, but it tells me how to save with an html file....and I cant seem to find the right command to save an access file.

    I found a few keywords, but when i tried to use them, it wouldnt give me any parameters or anything.

  5. #5

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Saving a database

    anyone? I also need to be able to load them..

  6. #6

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Saving a database

    *bump*

    Really need this one solved too :/

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Saving a database

    I need a bit more details.

    Typically you write code to save data to a table in a database, not the whole database itself.

    So, my first question is, why do want to save the entire database? Is this for backup purposes?

    Second, if you have the database open, then I'm guessing you aren't going to be able to do anything with it, until it is closed. So, if you do want to backup up, you probably want to write a little app that will do that for you.

  8. #8

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Saving a database

    hrm..i guess thats a good point

    But yes, I want it as backup purposes.

    Once a year I want to be able to click "Backup Database" and then that database will hold all the information for the previous year..so I can open it up at another date if needed.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Saving a database

    Quote Originally Posted by kfcSmitty
    hrm..i guess thats a good point

    But yes, I want it as backup purposes.

    Once a year I want to be able to click "Backup Database" and then that database will hold all the information for the previous year..so I can open it up at another date if needed.
    Ok. I have done this on a number of applications, but not using VBA. If this is a once a year utility program, then I would write a one screen VB program that:

    1. Closes the database
    2. Copies the database to whereever you need it to go
    3. Logs the date and time of the backup for future reference

  10. #10
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Saving a database

    VB Code:
    1. fileSaveName = Application.GetSaveAsFilename( _
    2.     fileFilter:="Text Files (*.txt), *.txt")
    3. If fileSaveName <> False Then
    4.     MsgBox "Save as " & fileSaveName
    5. End If

    i don't use access, so this is posted straight from the vba helpfile, and not tried

    then usew the returned filesavename with the saveas method

    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width