Subject: Database Path
Posted By: sampow Post Date: 12/3/2003 10:22:04 AM
I am using the below code to disable the shift key that by passes a macro.  How do i determine the path of the databse that I want it to affect?

Sub SetStartupProperties()

    ChangeProperty "AllowBypassKey", dbBoolean, False

End Sub



Function ChangeProperty()

    Dim strPropName As String

    Dim varPropType As Variant

    Dim varPropValue As Variant

    

    Dim dbs As Database, prp As Property

    Const conPropNotFoundError = 3270

    strPropName = "AllowBypassKey"

    varPropType = dbBoolean

    varPropValue = False

    Set dbs = I NEED THE PATH HERE

    On Error GoTo Change_Err

    dbs.Properties(strPropName) = varPropValue

    ChangeProperty = True

MsgBox "Welcome to First Choice"

Change_Bye:

    Exit Function



Change_Err:

    If Err = conPropNotFoundError Then  ' Property not found.

        Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)

        dbs.Properties.Append prp

        MsgBox "Please Try Again"

        Resume Next

    Else

        ' Unknown error.

        MsgBox "ok"

        ChangeProperty = False

        Resume Change_Bye

    End If

End Function







Sam Powell
Information Systems Officer
Neath Port Talbot College
Reply By: Steven Reply Date: 12/4/2003 6:37:49 PM
do you want to do it to a different DB? i.e not the one that this code is in?

if not, then just use CurrentDB, (or just type in AllowBypassKey into VBA help, and paste the example there)

if so, here's a page that shows you just about everything you would want to know about finding paths and the like:
http://www.sloppycode.net/fso/



I am a loud man with a very large hat. This means I am in charge

Go to topic 7170

Return to index page 992
Return to index page 991
Return to index page 990
Return to index page 989
Return to index page 988
Return to index page 987
Return to index page 986
Return to index page 985
Return to index page 984
Return to index page 983