Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - backup & compact access db wid asp script
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

backup & compact access db wid asp script

 Post Reply Post Reply
Author
riya_singtel View Drop Down
Newbie
Newbie
Avatar

Joined: 14 March 2005
Location: India
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote riya_singtel Quote  Post ReplyReply Direct Link To This Post Topic: backup & compact access db wid asp script
    Posted: 14 March 2005 at 10:17pm
I am writing a code in asp using vb script. Have to backup and compact my access database. Can someone help me with the right code since I have absolutely no idea how to do it.
Thanks a ton
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 15 March 2005 at 6:37am
to compact the database you can have a look at the forums built in one.

with regards to the back up feature.. i had required a simular feature what i did was

use FSO to make a copy of the database (was a file in my case but .mdb also works as i tested it).

to prevent erros etc i had copied the database on the webserver within a folder that is just made with the folder name being the date and time of creation.

one place to look for FSO is www.devguru.com

below is the code that creates a folder then  copies the file.


Set filesys = CreateObject("Scripting.FileSystemObject")

' check if the file exists
If filesys.FileExists(strAttachment) Then

set filetxt = filesys.GetFile(strAttachment)

StrDateAndTime = DateAdd("h",+0,NOW())

strTempPath = Day(StrDateAndTime) & "-" & Month(StrDateAndTime) & "-" & Year(StrDateAndTime) & "_" & Hour(StrDateAndTime) & "-" & Minute(StrDateAndTime) & "-" & Second(StrDateAndTime)


If Not filesys.FolderExists(strBackupPath & strTempPath) Then

   Set newfolder = filesys.CreateFolder(strBackupPath & strTempPath)

 
    filesys.CopyFile "path to file to back up", strBackupPath & strTempPath & "\"

 Set filesys = NOTHING
 


End If



replace strAttachment with the path to the .mdb file

Edited by dj air - 15 March 2005 at 6:38am
Back to Top
riya_singtel View Drop Down
Newbie
Newbie
Avatar

Joined: 14 March 2005
Location: India
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote riya_singtel Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2005 at 12:27am
ThanksSmile
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.