Solved

DisableByPassKey Access Data Project

Posted on 2006-11-24
3
328 Views
Last Modified: 2008-02-01
Hello

I am trying to disable the use of the shift key on startup.  I am using an Access 2003 (Access Data Project).  I am using the change property function on the MS site but it has no effect.

I am using this function....it fails because the dbs variable is set to 'Nothing' when it gets to ' dbs.Properties(strPropName) = varPropValue'


Function ChangeProperty(strPropName As String, _
 varPropType As Variant, varPropValue As Variant) As Integer
' The current listing in Access help file which will
' let anyone who can open the db delete/reset any
' property created by using this function, since
' the call to CreateProperty doesn't use the DDL
' argument
'
 Dim dbs As Database, prp As Property
 Const conPropNotFoundError = 3270

 Set dbs = CurrentDb
 On Error GoTo Change_Err
 dbs.Properties(strPropName) = varPropValue
 ChangeProperty = True

Change_Bye:
 Exit Function

Change_Err:
 If Err = conPropNotFoundError Then ' Property not found.
  Set prp = dbs.CreateProperty(strPropName, _
        varPropType, varPropValue)
  dbs.Properties.Append prp
  Resume Next
 Else
  ' Unknown error.
  ChangeProperty = False
  Resume Change_Bye
 End If
End Function
0
Comment
Question by:doddwell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
Leigh Purvis earned 200 total points
ID: 18006701
Function AllowByPass(Allow as Boolean)
    CurrentProject.Properties.Add "AllowBypassKey", Allow
End Function
0
 

Author Comment

by:doddwell
ID: 18006722
Well that was easy...thanks.  Why was I bothering with the complex function?....was that required with earlier versions of Access?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 18006789
No probs.

It was required back in Access 97.
And I'd say that many developers (myself included) have just kept using their same old stock function.
(I made the above function up just now :-)

It would work in Access 2000 onwards (which is where ADP's can feature too).
Your previous function would generally work in Access 2003 mdb's - but in an ADP there is no Jet engine processing, no DAO library - and the DAO objects (like CurrentDb) aren't created.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question