dmoring
asked on
VB Access 2000 Passwords
I am trying to connect to a Access .db with a global password.
TMRace = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dbFile & ";UID=Administrator;PWD=sa m1104;"
conn.Open TMRace
When I try to compact it after closing the above connection I get an error with the following code:
Dim strSourceDB As String
Dim strDestDB As String
Dim jetEngine As JRO.jetEngine
Dim strSourceConnect As String
Dim strDestConnect As String
strSourceDB = dbFile
strDestDB = dbArchive
Kill (dbArchive)
strSourceConnect = "Data Source=" & strSourceDB & ";"
strDestConnect = "Data Source=" & strDestDB & ";"
Set jetEngine = New JRO.jetEngine
jetEngine.CompactDatabase strSourceConnect, strDestConnect
Set jetEngine = Nothing
CompactDb = True
End Function
What is the proper syntax for this compact with the first connect string? Ideas?
dmoring
TMRace = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dbFile & ";UID=Administrator;PWD=sa
conn.Open TMRace
When I try to compact it after closing the above connection I get an error with the following code:
Dim strSourceDB As String
Dim strDestDB As String
Dim jetEngine As JRO.jetEngine
Dim strSourceConnect As String
Dim strDestConnect As String
strSourceDB = dbFile
strDestDB = dbArchive
Kill (dbArchive)
strSourceConnect = "Data Source=" & strSourceDB & ";"
strDestConnect = "Data Source=" & strDestDB & ";"
Set jetEngine = New JRO.jetEngine
jetEngine.CompactDatabase strSourceConnect, strDestConnect
Set jetEngine = Nothing
CompactDb = True
End Function
What is the proper syntax for this compact with the first connect string? Ideas?
dmoring
Ignore the above post. Got some errors. Below is the correct example.
Dim objDAO_DBEngine As Object
Dim objFSO As Object
Dim strCompactedDBFile As String
Set objDAO_DBEngine = CreateObject("DAO.DBEngine .36")
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
If objFSO.FileExists(dbArchiv e) Then
objFSO.DeleteFile (dbArchive)
End If
objDAO_DBEngine.CompactDat abase dbFile, dbArchive
objFSO.CopyFile dbArchive, dbFile
objFSO.DeleteFile dbArchive 'delete the copy
Set objFSO = Nothing
Set objDAO_DBEngine = Nothing
hongjun
Dim objDAO_DBEngine As Object
Dim objFSO As Object
Dim strCompactedDBFile As String
Set objDAO_DBEngine = CreateObject("DAO.DBEngine
Set objFSO = CreateObject("Scripting.Fi
If objFSO.FileExists(dbArchiv
objFSO.DeleteFile (dbArchive)
End If
objDAO_DBEngine.CompactDat
objFSO.CopyFile dbArchive, dbFile
objFSO.DeleteFile dbArchive 'delete the copy
Set objFSO = Nothing
Set objDAO_DBEngine = Nothing
hongjun
dmoring, you have few opened questions yet to be closed. Please maintain them.
hongjun
hongjun
ASKER
hongjun,
There is a way with existing VB objects - not creating new instances as in ASP. Also, I have a password on this one.
Other ideas?
Re: Unclosed questions - Did not get solution 2 of the 4 but closed them anyway and awarded points to the best answer. The other 2 are this one and one with points for someone who has yet to pick them up. Thanks for the reminder though.
dmoring
There is a way with existing VB objects - not creating new instances as in ASP. Also, I have a password on this one.
Other ideas?
Re: Unclosed questions - Did not get solution 2 of the 4 but closed them anyway and awarded points to the best answer. The other 2 are this one and one with points for someone who has yet to pick them up. Thanks for the reminder though.
dmoring
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Now you're onto my problem :-). With that It wants a workgroup file to pull the username/id from the system.mdw and I just want an overall password for the .db - NOT a user workgroup setup. If I put it in exactly as you describe (already did it - should have told you), I get the error 'Could not find WorkGroup file', which is correct. I don't have the .db set up for tiered-access - just an overall password.
Keep going - your on the right track!
dmoring
Keep going - your on the right track!
dmoring
ASKER
Got it! It was:
'Set Connect Strings
strSourceConnect = "Data Source=" & dbFile & ";" & _
"Jet OLEDB:Database Password=sam1104;"
strDestConnect = "Data Source=" & dbArchive & ";" & _
"Jet OLEDB:Database Password=sam1104;"
strTempConnect = "Data Source=" & dbTemp & ";" & _
"Jet OLEDB:Database Password=sam1104;"
without Database in front of password, it is looking for the workgroup information - NOT the overall password. Thanks for your effort and prompt response though!
'Set Connect Strings
strSourceConnect = "Data Source=" & dbFile & ";" & _
"Jet OLEDB:Database Password=sam1104;"
strDestConnect = "Data Source=" & dbArchive & ";" & _
"Jet OLEDB:Database Password=sam1104;"
strTempConnect = "Data Source=" & dbTemp & ";" & _
"Jet OLEDB:Database Password=sam1104;"
without Database in front of password, it is looking for the workgroup information - NOT the overall password. Thanks for your effort and prompt response though!
Dim objDAO_DBEngine As Object
Dim objFSO As Object
Dim strCompactedDBFile As String
Set objDAO_DBEngine = CreateObject("DAO.DBEngine
Set objFSO = CreateObject("Scripting.Fi
If objFSO.FileExists(strCompa
objFSO.DeleteFile (strCompactedDBFile)
End If
objDAO_DBEngine.CompactDat
objFSO.CopyFile dbArchive, dbFile
objFSO.DeleteFile dbArchive 'delete the copy
Set objFSO = Nothing
Set objDAO_DBEngine = Nothing
hongjun