Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 3rd, 2003, 11:22 AM
Authorized User
Join Date: Dec 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Database Path

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"


    Exit Function


    If Err = conPropNotFoundError Then ' Property not found.

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

        dbs.Properties.Append prp

        MsgBox "Please Try Again"

        Resume Next


        ' Unknown error.

        MsgBox "ok"

        ChangeProperty = False

        Resume Change_Bye

    End If

End Function

Sam Powell
Information Systems Officer
Neath Port Talbot College
Sam Powell
Information Systems Officer
Neath Port Talbot College
Old December 4th, 2003, 07:37 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts

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:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Path to database takwirira ASP.NET 2.0 Basics 2 April 4th, 2008 09:25 AM
Path to database backend Clive Astley Beginning VB 6 3 January 12th, 2007 01:29 AM
Implementing the all-path shortest path problem bitwords XSLT 1 December 6th, 2006 11:37 AM
using app.path in database path and filename kd8con VB Databases Basics 2 October 25th, 2006 11:45 AM
Invalid database Path MrDannyP VB Databases Basics 1 January 7th, 2004 10:15 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.