Re: Opening codes



Use this code:

Function ap_DisableShift()
'This function will disable the shift at startup causing the Autoexec macro
& Startup properties to always be executed

On Error GoTo errDisableShift
'This Function will disable the shift at startup causing the Autoexec macro
and startup properties to always be executed
'!!! WARNING !!!This proces is not reversable!!!!!

Dim db As Database
Dim prop As Property
Const conPropNotFound = 3270

Set db = CurrentDb()

'This next line disables the shift key on startup.

db.Properties("AllowByPassKey") = False

Exit Function

errDisableShift:
' The first part of this error routine creates the "AllowByPassKey
property if it does not exist.
If Err = conPropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", dbBoolean, False)
db.Properties.Append prop
Resume Next
Else
MsgBox "Function 'ap_DisableShift' did not complete
successfully."
Exit Function
End If

'The error-handling routine above starting with the line
'errDisableShift:

'If the AllowByPassKey property doesn't exist - which it doesn't by default
- the routine creates it and sets it to false.

'To enable the shift key to be used again on database startup : The only
difference from ap_DisableShift() is that
'False is changed to True when setting the AllowByPassKey property.
End Function

Remember, before using this code, backup your DB.


"Deanna" wrote:

Thank you!!! I have everything ready, switchboard & links etc. I would also
like to create an electronic library, do i need to install VB for this or can
i do this through access (2007)??
--
Dee


"Linq Adams via AccessMonster.com" wrote:

Goto Tools - Startup

Uncheck the "Display Database Window"

This means the Dialog box where you can click on Forms, Tables, Queries, etc
will not appear, unless you hold down the <Shift> key as you open the db.

If you do this, then obviously you have to use a series of "menu" or
"switchboard" forms to lead your users thru your database, giving them access
to whatever objects you want them to have access to. The initial form needs
to be selected, in this same place, Tools - Startup, in the "Display
Form/Page" box.

This, of course, only supplies limited security. As you've already stated,
holding <Shift> down when opening the database will show the Database Window,
as will pressing <F11> while the database is open. Security here, as most
places, depends on who/what you're trying to protect your database from. This
will work if you simply want to prevent non-Access savvy users from snooping.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200806/1


.



Relevant Pages

  • Re: Opening codes
    ... Doug Steele, Microsoft Access MVP ... 'This function will disable the shift at startup causing the Autoexec ... Dim db As Database ...
    (microsoft.public.access.modulesdaovba)
  • Re: Opening codes
    ... more secure syntax shown in http://www.mvps.org/access/general/gen0040.htm ... 'This function will disable the shift at startup causing the Autoexec ... Dim db As Database ...
    (microsoft.public.access.modulesdaovba)
  • Re: Locked myself out of my database
    ... > Try holding down the Shift key while you open the database. ... That disables ... > "startup" options. ...
    (microsoft.public.access.forms)
  • Re: Create MDE causes Access to crash
    ... Holding down Shift bypasses the AutoExec macro as well as the startup ... You might want to try holding down the Shift key while you compact the ... database, so that when it restarts your startup code does NOT run. ...
    (comp.databases.ms-access)
  • Re: I am stumped....TimeValue problem
    ... this got to do with my start and end of shift times based on what ... afternoon at work working on the database, ... I opened the database on the new computer the DLookup ... it for a time across midnight when Nowis past midnight and you may well ...
    (microsoft.public.access.formscoding)