|
-
Nov 29th, 2000, 06:33 AM
#1
Thread Starter
Fanatic Member
This is not a password problem per se. You have the database opened exclusively in code and you are trying to make another connection. Change the code to open the database for shared access.
Post the code up if you are still having problems.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 29th, 2000, 07:54 PM
#2
Lively Member
Thanks Paul
ok that explains everything. But I don't know how to go about doing that. All I want to do is to make sure unauthorized people can't just simply open the database and view or edit the database from there. I have no clue how to do the share, I'm still new at this, could you show me how?
Thanks again
-
Nov 30th, 2000, 08:18 AM
#3
Thread Starter
Fanatic Member
I really need to see the code you are using to access your reports to help. The exclusive setting can be over-ridden as part of the OpenDatabase options.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 30th, 2000, 09:07 AM
#4
Lively Member
Okay well for DAO I currently access the database through this:
Set db = OpenDatabase(strDBname, False, False)
but when I implemented the password, I used this line.
Set db = OpenDatabase(strDBname, True, False, ";pwd=" & strPassword)
That's when I got the error file. This is how I access my reports.
I just set the connection in the properties menu and when I access my datareports I call it's corresponding command and show the report like so
dataconnection1.command1
datareport1.show
[Edited by gin on 11-30-2000 at 09:15 AM]
-
Nov 30th, 2000, 09:19 AM
#5
Thread Starter
Fanatic Member
I would guess that the databse is open exclusively somewhere else (either in your code, or a lock file has not properly deleted). Close all the VB programs that refer to the database, then using Explorer, make sure that there is no .LDB file left.
To open for shared access you need to set the first boolean option to False
e.g.
Set db = OpenDatabase(strDBname, False, False, ";pwd=" & strPassword)
These are the default options (shared access, read/write) but cannot be ommitted when you use the connection string with the password. Presumably you are logging in as 'Admin'?
I also assume this code is being executed in VB and not from the Access database itself?
Make sure you are not opening the same database twice in code.
Hope that helps,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 30th, 2000, 09:39 AM
#6
Lively Member
well what I have is the database open by code for my whole application. I use dataconnections and datareports for my reports. My Database is opened exclusively and there's a password set to prevent anyone from just accessing the database.
Anyway I tried as you suggested, The problem isn't connecting with DAO, it's with the reports. Whenever I use my dataconnection (such as when I use commands) i get an error message saying invalid password. Where am I suppose to specify the password? I tried at properties of the data connection but it still doesn't work.
-
Nov 30th, 2000, 10:01 AM
#7
Thread Starter
Fanatic Member
I get an error message saying that is is already in use
Is it the "Password is Invalid" or "Already in Use"?
You need to be clear which it is. The first indicates a problem with the DataConnection properties, the second that you already have the database opened exclusively.
Which one?
I suspect that the DataConnection tries to set up a new connection to the database which you already have open exclusively as part of the App. Have you tried used shared access?
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 30th, 2000, 10:34 AM
#8
Lively Member
sorry if I'm a little confusing, thank you for the patience.
I tried what you suggested by opening my database through code by shared access. I don't get the error message of file already in use. Now I get is invalid password. Where do I specify the password?
-
Nov 30th, 2000, 10:42 AM
#9
Thread Starter
Fanatic Member
In the properties of a data connection, you can specify username and password. Have you got the Data View window open at design time? From the project browser, you can double click on the Data Environment which will open a Data Environment window. Right clicking on the Data Connection and selecting 'Properties' will open up a tabbed dialog box, select Connection and you can specify a user name/password.
These must be accessible at run-time but I am not sure how. I don't really use the Data Connections at all as I connect everything through code.
You have indicated that you have tried setting these already, but have you specified a User Name as well? If not, use 'Admin'.
Hope that helps.
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 30th, 2000, 10:58 AM
#10
Lively Member
well I tried what you suggested. Still no go, I get the invalid password error. I think the password you specify in the properties is the user's account password. I think the passsword needed is the password to open the database. The probelm is I don't know where to specify it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|