H
Harmannus
Hallo,
Some time ago i got the below code for bypassing the shift key. Use it
freuquently ;-)
Is it possible to run this code with Microsoft ActiveX data objects 2.1
library? I am not good at the ins and outs of the DAO ADO(ADOX)
differences. Default Access2000 uses ADO. Would like to limit the number of
references i use.
Hope somebody can help. Thanx in advance.
Regards,
Harmannus
'I have started any code with 'S**************** and ended it with
'E*****************
'S********************
Private Sub cmdFullAccess_Click()
On Error GoTo Err_cmdFull_Click
Call SetFullStartupProperties
Exit_cmdFull_Click:
Exit Sub
Err_cmdFull_Click:
MsgBox Err.Description
Resume Exit_cmdFull_Click
End Sub
'E************************
'S****************************
Private Sub cmdLimitedAccess_Click()
On Error GoTo Err_cmdLimit_Click
Call SetLimitedStartupProperties
Exit_cmdLimit_Click:
Exit Sub
Err_cmdLimit_Click:
MsgBox Err.Description
Resume Exit_cmdLimit_Click
End Sub
'E************************
'On the module level (modules) write (insert) the following codes:
'S*************************
Sub SetFullStartupProperties()
ChangeProperty "StartupForm", dbText, "EntryForm"
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
ChangeProperty "AllowToolbarChanges", dbBoolean, True
ChangeProperty "AllowFullMenus", dbBoolean, True
ChangeProperty "AllowShortcutMenus", dbBoolean, True
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, True
ChangeProperty "AllowBypassKey", dbBoolean, True
End Sub
'E********************
'S*******************
Sub SetLimitedStartupProperties()
ChangeProperty "StartupForm", dbText, "EntryForm" ' -------Warning here
"EntryForm" should be changed to name of your form.
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowToolbarChanges", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowShortcutMenus", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False
End Sub
'E******************
'S*******************
Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
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
'E**********************************
Now, put your form in run mode, and click the INVISIBLE button called
cmdLimitedAccess, and exit the data base.
Try to open it again and hold the SHIFT key. Startup properties must NOT be
bypassed and the form opens in run mode.
Some time ago i got the below code for bypassing the shift key. Use it
freuquently ;-)
Is it possible to run this code with Microsoft ActiveX data objects 2.1
library? I am not good at the ins and outs of the DAO ADO(ADOX)
differences. Default Access2000 uses ADO. Would like to limit the number of
references i use.
Hope somebody can help. Thanx in advance.
Regards,
Harmannus
'I have started any code with 'S**************** and ended it with
'E*****************
'S********************
Private Sub cmdFullAccess_Click()
On Error GoTo Err_cmdFull_Click
Call SetFullStartupProperties
Exit_cmdFull_Click:
Exit Sub
Err_cmdFull_Click:
MsgBox Err.Description
Resume Exit_cmdFull_Click
End Sub
'E************************
'S****************************
Private Sub cmdLimitedAccess_Click()
On Error GoTo Err_cmdLimit_Click
Call SetLimitedStartupProperties
Exit_cmdLimit_Click:
Exit Sub
Err_cmdLimit_Click:
MsgBox Err.Description
Resume Exit_cmdLimit_Click
End Sub
'E************************
'On the module level (modules) write (insert) the following codes:
'S*************************
Sub SetFullStartupProperties()
ChangeProperty "StartupForm", dbText, "EntryForm"
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
ChangeProperty "AllowToolbarChanges", dbBoolean, True
ChangeProperty "AllowFullMenus", dbBoolean, True
ChangeProperty "AllowShortcutMenus", dbBoolean, True
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, True
ChangeProperty "AllowBypassKey", dbBoolean, True
End Sub
'E********************
'S*******************
Sub SetLimitedStartupProperties()
ChangeProperty "StartupForm", dbText, "EntryForm" ' -------Warning here
"EntryForm" should be changed to name of your form.
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowToolbarChanges", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowShortcutMenus", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False
End Sub
'E******************
'S*******************
Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
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
'E**********************************
Now, put your form in run mode, and click the INVISIBLE button called
cmdLimitedAccess, and exit the data base.
Try to open it again and hold the SHIFT key. Startup properties must NOT be
bypassed and the form opens in run mode.