navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Free FrontPage Templates

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Compact and repair Secured Database

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Compact and repair Secured Database
Page: [1]
 
accessman

 

Posts: 74
Joined: 9/13/2005
Status: offline

 
Compact and repair Secured Database - 6/1/2006 14:03:12   
Hi,

I have a db1.mdb with user-level security. The Secured.mdw is security file. Everytime we need to refer Secured.mdw to open the db1.mdb.

I created another compact.mdb database for compact and repair the db1.mdb at night time.

In the compact.mdb:
I create the form and setup the timer to compact the db1.mdb at the night time.

I used

Public Function CompactAndRepairDB(sSource As String, _
sDestination As String, _
Optional sSecurity As String, _
Optional sUser As String = "Admins", _
Optional sPassword As String, _
Optional lDestinationVersion As Long) As Boolean

Dim sCompactPart1 As String
Dim sCompactPart2 As String
Dim oJet As JRO.JetEngine

On Error GoTo Err_compact

' Put together the provider string for the source database
sCompactPart1 = "Provider=Microsoft.Jet.OLEDB.4.0" & _
";Data Source=" & sSource & _
";User Id=" & sUser & _
";Password=" & sPassword


' If the database has a user-level security file, add the
' details
If sSecurity <> "" Then
sCompactPart1 = sCompactPart1 & _
";Jet OLEDB:System database=" & sSecurity & ";"
End If

' Put together the provider string for the destination
' database
sCompactPart2 = "Provider=Microsoft.Jet.OLEDB.4.0" & _
";Data Source=" & sDestination

' The destination database will end up in the latest version
' of jet, unless a specific version has been requested;
' 1 = Jet 1.0, 2 = Jet 1.1, 3 = Jet 2.x, 4 = Jet 3.x,
' 5 = Jet 4.x etc
If lDestinationVersion <> 0 Then
sCompactPart2 = sCompactPart2 & _
";Jet OLEDB:Engine Type=" & lDestinationVersion
End If

' Compact and repair the database
Set oJet = New JRO.JetEngine
oJet.CompactDatabase sCompactPart1, sCompactPart2
Set oJet = Nothing

CompactAndRepairDB = True

Exit_compact:
Exit Function
Err_compact:
MsgBox Err.Description
Resume Exit_compact
End Function



Function CompactWithSecurity()
Call CompactAndRepairDB("c:\db1.mdb", "c:\tmp.mdb", "c:\Secured.mdw", "jim")
End Function

It works, because jim is Adminstrator.

But, if Jim is not Adminstrator, then it doesn't work.
if jim is assigned "Backup Operators" and "Read-Only Users" permission by Adminstrator. When Jim logged in the Account, Jim can compact the database from clicking option menu (Database Ulities->Compact and Repair Database...).

If he used compact.mdb database to compact the db1.mdb
with this function
Function CompactWithSecurity()
Call CompactAndRepairDB("c:\db1.mdb", "c:\tmp.mdb", "c:\Secured.mdw", "jim")
End Function

Then it doesn't work.

How can I fix the function?
I want jim to compact the db1.mdb using compact.mdb. But, he is NOT adminstrator. I want to assign limit permission to him to compact the database using compact.mdb file to compact the db1.mdb at the night time.

Thanks.
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Compact and repair Secured Database
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts