Password for accessing tables and queries

  • Thread starter Thread starter sg
  • Start date Start date
S

sg

Hi,
I didn't have time to look through all the messages, my question might be
there already but I really need someone to point it out for me please.

I have access database located on shared drive, I like to ask user to access
it without username and password, but I don't want them to see my design or
tables. I like to have password to protect my tables, queries and forms,
please help

I tried AllowByPassKey, never works for me.

Appreciate any help.
Sarah
 
You can make an MDE and that will lock them out of some of it. Despite the
fact that your time is so precious, you can spend your own time looking at
the help fiel to see what an MDE file does, or search the newsgroup for more
details. Sorry WE don't have time to do YOUR legwork.

Rick B
 
Thanks for your reply. I will do my own home work.
I didn't mean to use anybody's time on purpose. I did search the newsgroup,
as you know, everytime you type the keyword in, it doesn't give much. I just
need a quick point out here since a lot of experts are here and I can do
more research on my own.

Sarah
 
Sarah, you'll generally get more help, if you give more information.

For example:


"I tried AllowByPassKey, never works for me."

That is not nearly enough information for someone to take that problem
on. *How* does it not work? Does your code get an error? If so, when -
and what error? Does the code run properly, but the bypass does not
actually work?


"as you know, everytime you type the keyword in, it doesn't give much."

How can I possibly know that? I don't even know what search engine you
are using! What is an example keyword that you typed in. In what sense
did that "not give much"? Did you get few entries, or many (but they
were all irrelevant)?


I'm not trying to help you with the actual problems above. I'm just
pointing out that you need to give more detailed information, to get
the best answers out of these newsgroups :-)

Cheers,
TC
 
Hi TC,

I don't mind if someone says that my quesiton is not clear, just I don't
like the words saying I gave my work to somebody to do. I understand
everybody is busy too, just in my post I frankly said that I need a help in
hurry which doesn't mean I want expert to the whole work for me. I need
direction.

I'm in outlook express news section, click "find", if I put password as key
word in subject, I didn't get much information. The reason I mention
"AllowByPassKey" is that because I thought other than "AllowByPassKey"
method, could be something simple like password to do that I'm not aware of
since I'm still learning. I need a direction. Also I searched around this
newsgroup about allowbypasskey, tried a few codes.I'm kinda stuck here.
Could you please help me with "AllowByPassKey" if possible? I copy the code
and paste into my access vb module as a function and ran it as macro. I ran
the code, but it didn't work.
Please see the code below that I used:

Public Function SetAllowBypassKey(bBypass As Boolean)
'******************************************************
' Sub SetAllowBypassKey(bBypass As Boolean) Access 97
'
' Sets the AllowBypassKey property of the Properties
' collection of
' the current database to either True or False. Takes
' effect the next
' time the database is opened.
'********************************************************
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270
'Occurs if the property doesn't exist
Const strKey = "AllowBypassKey"
'Our property name
Set dbs = CurrentDb
'Set object to the current database
On Error GoTo SetAllowBypassKeyErr
'Specify error handler
If bBypass = False Then
dbs.Properties(strKey) = False
'Set AllowBypassKey to False
Else
dbs.Properties(strKey) = True
'Set AllowBypassKey to True (default)
End If

'If bBypass = True Then
' MsgBox "Enabled"
'Else
' MsgBox "Disabled"
'End If

SetAllowBypassKeyExit:
Exit Function

SetAllowBypassKeyErr:
If Err = conPropNotFoundError Then
' Property doesn't exist yet
If bBypass = False Then
' Create the property
Set prp = dbs.CreateProperty(strKey, dbBoolean, False)
Else
Set prp = dbs.CreateProperty(strKey, dbBoolean, True)
End If
dbs.Properties.Append prp
' Add it to the collection
Resume SetAllowBypassKeyExit
End If

End Function

In macro,
I created a macro called 'Usermode', and runcode--function name:
AllowByPassKey(0).
When I reopen the access db while holding shift, still see db window.

Thanks in advance,
Sarah
 
Hi Jeff,

When I run this application. I got an error saying 'type mismatch' and the
code was highlighted is below:
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)

Please help.
Sarah
 
Hi Sarah,

You probably need to set a reference to the DAO object library
in Albert's utility. Close all open forms in his utility and then follow
these steps:

- Open any module in Design view.
- On the Tools menu, click References.
- Scroll down till you get to Microsoft DAO 3.xx and check it.
- If you're using Access 2000, 2002, or 2003 that should be DAO 3.6 Object Library.
- Close the References box again.
- Now re-compile again. Debug--Compile.
- Hopefully you should not see any more compile errors.

It may already be checked, but marked as Missing.
If so, uncheck it, close the References box, re-open
the box, and then re-check the DAO one.
Then re-compile and then run the utility.
 
Hi Sarah

That is a way better question because it short, to the point, shows the
line(s) of code in question, and says exactly what the error is.

Good luck with your coding!

Cheers,
TC
 
Hi Jeff,

I looked the reference, DAO already there, but I did what you told me to
uncheck it and re-check it, then compile. I didn't get any error when I
compile. Just when I run it, it says 'Type mismatch' on same code line.
Sarah
 
sg said:
Hi Jeff,

I looked the reference, DAO already there, but I did what you told me
to uncheck it and re-check it, then compile. I didn't get any error
when I compile. Just when I run it, it says 'Type mismatch' on same
code line. Sarah

Sounds like you may also have Microsoft ActiveX Data Objects checked. It's
unlikely that you'll use it, so uncheck it.
 
Hi Sarah,

The problem is arising most likely because there is a reference
set to both the ADO and DAO object libraries. Since both
of those libraries have an object called "Property", Access
is confused at this point as to which one you would like to
use. So the module code goes down to the error handler
with a mismatch error on the line you posted. In essence,
Access is going, "Sarah, I'm confused. Which direction
do you want to go to?"

There are two ways to solve this. Each is real easy.

First way: Uncheck ADO reference
1. Open Albert's utility database and close the startup form.
2. Open the References dialog box by going to any code window.
3. Uncheck the ActiveX Data Objects Reference if present.
4. Compile the code, save the changes.
5. Close the utility and then re-open. Now test again by
browsing for the file you want and hit the Disable button.

Second way: Disambiguate the declarations
1. Open Albert's utility database and close the startup form.
2. Open the ChangeProps module in Design View.
3. Change this line....

Dim prp As Property

to....

Dim prp As DAO.Property

4. Compile the code, save the changes.
5. Close the utility and then re-open. Now test again by
browsing for the file you want and hit the Disable button.

Everything should be fine now.

I would actually do both methods myself.
Hope that helps,
 
Hello Jeff and Joan,

Both of you are very helpful. Finally it works great for me.

Thanks so much,
Sarah
 
Back
Top