473,326 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Compacting Access Database

Hello,

I've been using the interop.jro.dll to compact the Access database my
aplication uses. After setting a password for the database and changing my
oledb connection settings to include that password, I can no longer compact
the database. I get an error saying "Not a valid password." The code I've
been using to compact is:

....
Dim jro As JRO.JetEngine = New JRO.JetEngine()

jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB. 4.0;Data Source=C:\Program
Files\TestMaster\TestMaster.tmd", "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Program Files\TestMaster\TestMaster2.tmd;Jet OLEDB:Engine Type=5")
....

..tmd is my own extension
This code creates a second compacted database "TestMaster2", which I then
rename to TestMaster1. After I set the password, though, this code brings
the aforementioned error. All other aspects of accessing the database work
fine, though.
Nov 20 '05 #1
5 2312
On Sat, 10 Jan 2004 17:10:24 +0200, "Nathan" <nk*********************@softhome.net> wrote:

¤ Hello,
¤
¤ I've been using the interop.jro.dll to compact the Access database my
¤ aplication uses. After setting a password for the database and changing my
¤ oledb connection settings to include that password, I can no longer compact
¤ the database. I get an error saying "Not a valid password." The code I've
¤ been using to compact is:
¤
¤ ...
¤ Dim jro As JRO.JetEngine = New JRO.JetEngine()
¤
¤ jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB. 4.0;Data Source=C:\Program
¤ Files\TestMaster\TestMaster.tmd", "Provider=Microsoft.Jet.OLEDB.4.0;Data
¤ Source=C:\Program Files\TestMaster\TestMaster2.tmd;Jet OLEDB:Engine Type=5")
¤ ...
¤
¤ .tmd is my own extension
¤ This code creates a second compacted database "TestMaster2", which I then
¤ rename to TestMaster1. After I set the password, though, this code brings
¤ the aforementioned error. All other aspects of accessing the database work
¤ fine, though.
¤

Could you post your code and identify the line where the error occurs? I don't see where you are
specifying a password in the above code.
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 20 '05 #2
Sorry I wasn't clear. I used the wizard to create the connection and
specified the password there, the same password as is set in the database.
The code I posted is the original code I used before setting the password.
I'd just like to know what I need to add to specify the password.

Thanks

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:r1********************************@4ax.com...
On Sat, 10 Jan 2004 17:10:24 +0200, "Nathan" <nk*********************@softhome.net> wrote:
¤ Hello,
¤
¤ I've been using the interop.jro.dll to compact the Access database my
¤ aplication uses. After setting a password for the database and changing my ¤ oledb connection settings to include that password, I can no longer compact ¤ the database. I get an error saying "Not a valid password." The code I've ¤ been using to compact is:
¤
¤ ...
¤ Dim jro As JRO.JetEngine = New JRO.JetEngine()
¤
¤ jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB. 4.0;Data Source=C:\Program ¤ Files\TestMaster\TestMaster.tmd", "Provider=Microsoft.Jet.OLEDB.4.0;Data
¤ Source=C:\Program Files\TestMaster\TestMaster2.tmd;Jet OLEDB:Engine Type=5") ¤ ...
¤
¤ .tmd is my own extension
¤ This code creates a second compacted database "TestMaster2", which I then ¤ rename to TestMaster1. After I set the password, though, this code brings ¤ the aforementioned error. All other aspects of accessing the database work ¤ fine, though.
¤

Could you post your code and identify the line where the error occurs? I don't see where you are specifying a password in the above code.
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 20 '05 #3
After I set the password, though, this code
brings
¤ the aforementioned error. All other aspects of accessing the database

work
¤ fine, though.
¤

Could you post your code and identify the line where the error occurs? I

don't see where you are
specifying a password in the above code.

Hope This Helps

For standard security

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\myDb.mdb;" & _
"User Id=admin;" & _
"Password="
If using a Workgroup (System Database)

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:System Database=MySystem.mdw", _
"myUsername", "myPassword" Note, remember to convert both the MDB
and the MDW to the 4.0
database format when using the 4.0 OLE DB Provider.
If MDB has a database password

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPassword", _
"myUsername", "myPassword"
Nov 20 '05 #4
Scorpion,

As per your suggestion, this is the code I have now, and it works perfectly:

jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB. 4.0;Data Source=C:\Program
Files\TestMaster\TestMaster.tmd;Jet OLEDB:Database Password=macannlyd",
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program
Files\TestMaster\TestMaster2.tmd;Jet OLEDB:Database Password=macannlyd;Jet
OLEDB:Engine Type=5")

Thanks for the help!

"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:eE****************@TK2MSFTNGP11.phx.gbl...
After I set the password, though, this code
brings
¤ the aforementioned error. All other aspects of accessing the
database work
¤ fine, though.
¤

Could you post your code and identify the line where the error occurs?
I don't see where you are
specifying a password in the above code.


Hope This Helps

For standard security

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\myDb.mdb;" & _
"User Id=admin;" & _
"Password="
If using a Workgroup (System Database)

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:System Database=MySystem.mdw", _
"myUsername", "myPassword" Note, remember to convert both the

MDB and the MDW to the 4.0
database format when using the 4.0 OLE DB Provider.
If MDB has a database password

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPassword", _
"myUsername", "myPassword"


Nov 20 '05 #5
no problem.

Solutions like these can be found in the VB.NET/ADO.NET Newsgroup Search
Tool at
http://www.kjmsolutions.com/newsgrouptool.htm
"Nathan" <nk*********************@softhome.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Scorpion,

As per your suggestion, this is the code I have now, and it works perfectly:
jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB. 4.0;Data Source=C:\Program Files\TestMaster\TestMaster.tmd;Jet OLEDB:Database Password=macannlyd",
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program
Files\TestMaster\TestMaster2.tmd;Jet OLEDB:Database Password=macannlyd;Jet
OLEDB:Engine Type=5")

Thanks for the help!

"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:eE****************@TK2MSFTNGP11.phx.gbl...
After I set the password, though, this code
brings
> ¤ the aforementioned error. All other aspects of accessing the database work
> ¤ fine, though.
> ¤
>
> Could you post your code and identify the line where the error
occurs?
I don't see where you are
> specifying a password in the above code.

Hope This Helps

For standard security

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\myDb.mdb;" & _
"User Id=admin;" & _
"Password="
If using a Workgroup (System Database)

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:System Database=MySystem.mdw", _
"myUsername", "myPassword" Note, remember to convert both the

MDB
and the MDW to the 4.0
database format when using the 4.0 OLE DB Provider.
If MDB has a database password

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPassword", _
"myUsername", "myPassword"


Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Peter Verhelst | last post by:
Hello, Currently I am running an Access database on a windows WTS server, running Microsoft Windows 2000 server 5.00.2195 Service Pack 3. This database should be accessible for everybody in our...
1
by: Annette Massie | last post by:
I have an Access 2000 database we originally had on a server in our network and used asp to connect to it, browse and display records. I have queries that run at 3:00 am in the morning to delete...
5
by: lappy | last post by:
Hello, I have written a small programme to compact an access 97 database. Dim je As New JRO.JetEngine ' Compacts database Data.Mdb to Data2.mdb. je.CompactDatabase...
2
by: Simon Johnson | last post by:
Hi all, I'm writing a program that does a lot of table droping and updating.. After i've performed these steps it would be nice to run the compact and repair function on the database. How can I...
1
by: Lyle Fairfield | last post by:
Today I asked Access 2007 to compact db1.mdb. Access 2007 showed a message to me that I did not read carefully; my recollection is that it said it could not save the compacted copy as db1.mdb,...
7
by: DavidB | last post by:
I have a standard FE/BE database. I'd like to be able to have a button on each db that allows the admin to compact the database. I am using the following code to perform the compact. Private...
1
by: Slez via AccessMonster.com | last post by:
I do a routine compact and repair on a back end MS Access 2002 database. This time I had something peculiar occur. The compact started as normal, than the following error message popped up (I...
3
by: DSSMaster | last post by:
I am trying to use windows scheduler to compact a database. In the task run line I have the following: "C:\Program Files\Microsoft Office\OFFICE11 MSACCESS.EXE" _ "C:\Files\Access\Sacroc.mdb"...
2
by: HH | last post by:
It seems like the built-in compact function does not compact at all. A mdb file made under 2003 has been grown to over 100Mb. Compacting in access 2003 results in a file smaller then 5Mb....
32
by: Andy | last post by:
To further follow up on my last post regarding the docmd.quit vs. Application.quit using access 2007, I noticed that docmd.quit will correctly compact the database (program file) if you have the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.