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