-
Ok say you create a db like this:
Set dbsData = CreateDatabase("C:\NewDB.mdb", dbLangGeneral & ";pwd=password")
ok so now you want to open it like this
Set dbsData = OpenDatabase("C:\NewDB1.mdb")
but then you get a message and error saying invalid password so I looked in then help and it says this
Set database = workspace.OpenDatabase (dbname, options, read-only, connect)
and it says for the connect Optional. A Variant (String subtype) that specifies various connection information, including passwords. I have tried and tried so many different ways to put the password in there and nothing works. so how do you open it?
Thanks!!
-
You have to pass the password to the OpenDatabase function everytime you try to open a database with password protection via the Connect parameter. In other words the Connect string parameter isn't optional when your database requires a password to be opened.
Code:
Set dbs = DBEngine.OpenDatabase("C:/MyDataBase.mdb", , , ";PWD=Password")
:)
-
Somethings Wrong
You Gave me this code: Set dbs = DBEngine.OpenDatabase("C:/MyDataBase.mdb", , , ";PWD=Password")
I have no idea what to put for dbengine and dbs but i was taught to put this
Set dbsData = OpenDatabase("C:\NewDB.mdb")
so i figured i would do a little something like this
Set dbsData = OpenDatabase("C:\NewDB.mdb", , , ";pwd=password")
But to no luck it still didn't work so I added
Set dbsData = dbengine.OpenDatabase("C:\NewDB.mdb", , , ";pwd=password")
and then the invalid password came back up.
so why on earth is it still giving me invalid password?
-
Are you passing the correct password to the function, it is case sensitive so if when you set the password you typed it in all caps then you need to pass it as all caps. I think the VB help file can best describe the DBEngine object.
-
Missing parameter
Hi PITBULLCJR,
you are missing two parameters in your OpenDatabase statement, it should be like below:
Code:
Set db = DBEngine.Workspaces(0).OpenDatabase(App.Path & "\db1.mdb", False, False, ";pwd=password")
pls. refer below for more information:
Syntax
Set database = workspace.OpenDatabase (dbname, options, read-only, connect)
The OpenDatabase method syntax has these parts.
database An object variable that represents the Database object that you want to open.
workspace Optional. An object variable that represents the existing Workspace object that will contain the database. If you don't include a value for workspace, OpenDatabase uses the default workspace.
dbname A String that is the name of an existing Microsoft Jet database file, or the data source name (DSN) of an ODBC data source. See the Name property for more information about setting this value.
options Optional. A Variant that sets various options for the database, as specified in Settings.
read-only Optional. A Variant (Boolean subtype) value that is True if you want to open the database with read-only access, or False (default) if you want to open the database with read/write access.
connect Optional. A Variant (String subtype) that specifies various connection information, including passwords.
-
Thanks!!!!!
Thank You YoungBuck for trying to help me!!! Thank You Chris for fixing the problem. I have a question for you both nope nevermind fixed it. The problem was I couldn't create a new Table but stupid me forgot to dim tdftable as tabledef so thanks anyway. Thank you again so much!!
-
Are....
Are you guys (YoungBuck and Chris) very good Database programmers? If you are do you think I could like keep your email addresses in my address book so that if I have any questions I could email them to you? Thanks!!
-
Sure or you can just post it here! :D :p
[Edited by YoungBuck on 05-27-2000 at 02:02 PM]
-
Keep in touch
Hi PITBULLCJR,
Yes, you're welcome to keep me n your address book, mean while you also can post to this bulletin board, cause I'll read the post from time to time.
:)
-