Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turn off Shift Bypass key in .adp

Status
Not open for further replies.

Raptor717

Programmer
Mar 3, 2003
4
0
0
US
The following code works great in a .mdb but not for a .adp. This is the module I use to turn the Shift Bypass key off. Does ANYONE know what I need to change to get it to work?



Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer

On Error GoTo Err_SetProperties

Dim db As DAO.Database, prp As DAO.Property

Set db = CurrentDb
db.Properties(strPropName) = varPropValue
SetProperties = True
Set db = Nothing

Exit_SetProperties:
Exit Function

Err_SetProperties:
If Err = 3270 Then 'Property not found
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
SetProperties = False
MsgBox "SetProperties", Err.Number, Err.Description
Resume Exit_SetProperties
End If
End Function
 
Good Afternoon!

Below it the title of the article that relates to the startup properties of a Project. The article covers programming in both the *.adp and *.mdb environments. I have used it to set a few of the properties for my applications. Sorry, I have not used it for the ByPass key yet.

Setting Startup Options Programmatically in Access 2000

' *** Here is some of the code ***

Public Sub SetADPAppTitle()
Dim dbs As CurrentProject
Dim prp As ADODB.Property
Dim strTitle As String

Const INVALID_PROPERTY_REFERENCE As Integer = 2455

On Error GoTo ErrorHandler

Set dbs = Application.CurrentProject
strTitle = "Setting *.ADP Startup Options"

'Try to set the property, if it fails, the property does not exist.
dbs.Properties("AppTitle") = strTitle

' *** Here is one of the start up properties ***
dbs.Properties("StartupShowDBWindow") = False

'Refresh the title bar to reflect the change.
Application.RefreshTitleBar

ExitLine:
Set dbs = Nothing
Set prp = Nothing
Exit Sub

ErrorHandler:
If Err.Number = INVALID_PROPERTY_REFERENCE Then
' Create the new property.
dbs.Properties.Add "AppTitle", strTitle
Resume Next
Else
Resume ExitLine
End If
End Sub
' *****************************************

I hope this helps!!!

Good Luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top