Startup Options - I'm an idiot

D

Derek Wittman

Good morning
Don't worry, all's okay. But I want to help myself prevent the grief I've just encountered. I have a front end mde file that I have associated with Tony Toew's Auto FE deployer. Fantastic little program! Anyway, whenever I need to make some modifications to it, I go to the mde file, turn back on all the menus, options, etc in the Startup area and then restart the software. I make the mods, then I go back into the Startup routine (it's only permitted for my userID with a transparent button). Well, I guess I forgot to put the F_Startup in for my opening form, so I got it stuck.

Fortunately, I had a backup (thanks to Cheryl for constantly reminding me!). I'm wondering if there's some way to change the startup props from a different database using VBA. This would be a great help to me if there was

Can someone offer some insight? Any would be appreciated! Thanks
Derek
 
A

Allen Browne

Try this kind of thing, passing in True or False:

Function StartupProps(bSet As Boolean)
'NOTE: For Access 2002, must to do this to prevent Access showing the db
window (kb 313915):
' Application.SetOption("ShowWindowsInTaskbar"), False

Dim db As DAO.Database
Dim strDb As String
Dim strPrp As String
strDb = "C:\MyPath\MyFile.mde"
Set db = OpenDatabase(strDb)

' Application.SetOption "Track Name AutoCorrect Info", bSet
' Application.SetOption "Perform Name AutoCorrect", bSet
' Application.SetOption "Log Name AutoCorrect Changes", bSet

' ChangeProperty db, "StartupForm", dbText, "Customers"
' ChangeProperty db, "StartupShowDBWindow", dbBoolean, bSet
' ChangeProperty db, "StartupShowStatusBar", dbBoolean, bSet
' ChangeProperty db, "AllowBuiltinToolbars", dbBoolean, bSet
' ChangeProperty db, "AllowBreakIntoCode", dbBoolean, bSet
' Call ChangeProperty(db, "AllowFullMenus", dbBoolean, bSet)
Call ChangeProperty(db, "AllowSpecialKeys", dbBoolean, bSet)
Call ChangeProperty(db, "AllowBypassKey", dbBoolean, bSet)

db.Close
Set db = Nothing
End Function

Function ChangeProperty(dbs As Database, strPropName As String, varPropType
As Variant, varPropValue As Variant) As Integer
Dim prp As Property
Const conPropNotFoundError = 3270

On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Debug.Print strPropName & " is " & varPropValue

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


--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Derek Wittman said:
Good morning,
Don't worry, all's okay. But I want to help myself prevent the grief I've
just encountered. I have a front end mde file that I have associated with
Tony Toew's Auto FE deployer. Fantastic little program! Anyway, whenever I
need to make some modifications to it, I go to the mde file, turn back on
all the menus, options, etc in the Startup area and then restart the
software. I make the mods, then I go back into the Startup routine (it's
only permitted for my userID with a transparent button). Well, I guess I
forgot to put the F_Startup in for my opening form, so I got it stuck.
Fortunately, I had a backup (thanks to Cheryl for constantly reminding
me!). I'm wondering if there's some way to change the startup props from a
different database using VBA. This would be a great help to me if there
was.
 
A

Allen Browne

Yes. Just point strDb to the name of your database.

The actual property names generally match those under Tools | Options, so
you can generally figure out what they do. Many of the options in that
example are commented out. They are there simply as examples of the names
you can use.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Derek Wittman said:
Looks rather robust, Allen. I'm not exactly sure what it's doing. This
will work from another db to get to the one I'm stuck with?
 
D

Derek Wittman

Microsoft products are just so intuitive that way. Thanks again Allen. I think I'll make a standalone (although non-runtime) application to do this. That said, couldn't someone ELSE break into my mde file the same way? (I have the MDB and backup MDE on my hard drive

(I realise that even the best security methods won't keep out 100% of the riff-raff. However, I'm also understanding that nearly 100% will give up - but not all.

Dere

----- Allen Browne wrote: ----

Yes. Just point strDb to the name of your database

The actual property names generally match those under Tools | Options, s
you can generally figure out what they do. Many of the options in tha
example are commented out. They are there simply as examples of the name
you can use

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.htm
Reply to group, rather than allenbrowne at mvps dot org

Derek Wittman said:
Looks rather robust, Allen. I'm not exactly sure what it's doing. Thi
will work from another db to get to the one I'm stuck with
Thanks Dere
PS: I generally use 'robust' to mean big and confusing. <g>>> ----- Allen Browne wrote: ----
Try this kind of thing, passing in True or False
Function StartupProps(bSet As Boolean
'NOTE: For Access 2002, must to do this to prevent Access showing th d
window (kb 313915)
' Application.SetOption("ShowWindowsInTaskbar"), Fals
Dim db As DAO.Databas
Dim strDb As Strin
Dim strPrp As Strin
strDb = "C:\MyPath\MyFile.mde
Set db = OpenDatabase(strDb
' Application.SetOption "Track Name AutoCorrect Info", bSe
' Application.SetOption "Perform Name AutoCorrect", bSe
' Application.SetOption "Log Name AutoCorrect Changes", bSe
' ChangeProperty db, "StartupForm", dbText, "Customers
' ChangeProperty db, "StartupShowDBWindow", dbBoolean, bSe
' ChangeProperty db, "StartupShowStatusBar", dbBoolean, bSe
' ChangeProperty db, "AllowBuiltinToolbars", dbBoolean, bSe
' ChangeProperty db, "AllowBreakIntoCode", dbBoolean, bSe
' Call ChangeProperty(db, "AllowFullMenus", dbBoolean, bSet
Call ChangeProperty(db, "AllowSpecialKeys", dbBoolean, bSet
Call ChangeProperty(db, "AllowBypassKey", dbBoolean, bSet
Set db = Nothin
End Functio
Function ChangeProperty(dbs As Database, strPropName As String
varPropTyp
As Variant, varPropValue As Variant) As Intege
Dim prp As Propert
Const conPropNotFoundError = 327
On Error GoTo Change_Er
dbs.Properties(strPropName) = varPropValu
ChangeProperty = Tru
Debug.Print strPropName & " is " & varPropValu
Change_Bye Exit Functio
Change_Err
If Err = conPropNotFoundError Then ' Property not found
Set prp = dbs.CreateProperty(strPropName,
varPropType, varPropValue
dbs.Properties.Append pr
Resume Nex
Els
' Unknown error
ChangeProperty = Fals
Resume Change_By
End I
End FunctioAllen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.htm
Reply to group, rather than allenbrowne at mvps dot org
 
A

Allen Browne

Yes: a knowledgeable person can read an MDE that way, but anyone who knows
how to do that would probably know several other ways to read your tables
and queries also.

What they cannot do with an MDE is read your code, since the text version of
the code is not present. More importantly, the MDE cannot decompile.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Derek Wittman said:
Microsoft products are just so intuitive that way. Thanks again Allen. I
think I'll make a standalone (although non-runtime) application to do this.
That said, couldn't someone ELSE break into my mde file the same way? (I
have the MDB and backup MDE on my hard drive)
(I realise that even the best security methods won't keep out 100% of the
riff-raff. However, I'm also understanding that nearly 100% will give up -
but not all.)
 
A

Albert D. Kallal

Why not just hold down he shift key during start-up..then all start options
are ignored.

You develop, test..etc..then exit..and re-load the application (this time
NOT holding down the shift key).

Thus, you can switch between development mode..and user test mode very easy.
Anyway, whenever I need to make some modifications to it, I go to the mde
file

How can you modify a mde file? you can only make changes to the mdb file.

So, during development,I do have all the start-up options etc set on my
mdb..but I just hold down the shift key during start-up. when I make the
mde..it is ready to go...about the only change I might make is to dis-able
the shift key by-pass..
 
D

Derek Wittman

Thanks, Albert. I could always use the shift-bypass. However, I have a module disabling it. <g> To a good many of the folks in my company, it's a pretty good roadblock. Between that and the disabling of the CLOSE and EXIT functions, I think it's pretty tight. Of course, there are a great many of you out there who wouldn't have any trouble getting in and toying with it

Thanks again
Dere

----- Albert D. Kallal wrote: ----

Why not just hold down he shift key during start-up..then all start option
are ignored

You develop, test..etc..then exit..and re-load the application (this tim
NOT holding down the shift key)

Thus, you can switch between development mode..and user test mode very easy
Anyway, whenever I need to make some modifications to it, I go to the md
fil

How can you modify a mde file? you can only make changes to the mdb file

So, during development,I do have all the start-up options etc set on m
mdb..but I just hold down the shift key during start-up. when I make th
mde..it is ready to go...about the only change I might make is to dis-abl
the shift key by-pass.


-
Albert D. Kallal (MVP
Edmonton, Alberta Canad
(e-mail address removed)
http://www.attcanada.net/~kallal.ms
 
D

Derek Wittman

Very good point, Allen. Now, I'm on to setting up slot ranges (shelf locations) that depend on what side of an aisle I'm looking to...

I'm in a strange business...

Derek

----- Allen Browne wrote: -----

Yes: a knowledgeable person can read an MDE that way, but anyone who knows
how to do that would probably know several other ways to read your tables
and queries also.

What they cannot do with an MDE is read your code, since the text version of
the code is not present. More importantly, the MDE cannot decompile.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Derek Wittman said:
Microsoft products are just so intuitive that way. Thanks again Allen. I
think I'll make a standalone (although non-runtime) application to do this.
That said, couldn't someone ELSE break into my mde file the same way? (I
have the MDB and backup MDE on my hard drive)riff-raff. However, I'm also understanding that nearly 100% will give up -
but not all.)
 
A

Albert D. Kallal

Derek Wittman said:
Thanks, Albert. I could always use the shift-bypass. However, I have a
module disabling it. <g>

Right...but you don't disable the shift key until you make the mde..right?

I mean, during the day I often exit..and re-run my ap;licton during
development...I try a few things..and exit..and then hold down shift while I
re-enter. So, this flipping between testing as a user and development occurs
very fast. Quick exit...re-enter (in fact,I whack alt-f4 to exit..then whack
enter to re-enter as a "user"). This is two keys strokes..and occurs in
flash! Of course..I can hit the enter key...since the mdb file is still
highlight in the explore window.

So, my only point here was then you ONLY need disable the shift key stuff
WHEN YOU create the mde...not during regular development (since, as per
above...is very quick to test start-up options..and then go back to
development mode and use the shift-bypass).

So, only disable the shift key by-pass in the mde......
 
D

Derek Wittman

Ahhhhh! Okay. Well, there are some things I need to check occasionally in the mde. It's rare, but it happens. Especially when I keep forgetting where I put the backup mdb file... I'm short-term memory challenged lately.

I understand and agree that if the mde is merely a 'crippled' version of the mdb, it would be better to work on the mdb, then make a new mde from it. Then, I would place the new MDE in my autoFE directory and let Tony's AutoFE deployment tool do the rest

Dere

----- Albert D. Kallal wrote: ----

Derek Wittman said:
Thanks, Albert. I could always use the shift-bypass. However, I have
module disabling it. <g

Right...but you don't disable the shift key until you make the mde..right

I mean, during the day I often exit..and re-run my ap;licton durin
development...I try a few things..and exit..and then hold down shift while
re-enter. So, this flipping between testing as a user and development occur
very fast. Quick exit...re-enter (in fact,I whack alt-f4 to exit..then whac
enter to re-enter as a "user"). This is two keys strokes..and occurs i
flash! Of course..I can hit the enter key...since the mdb file is stil
highlight in the explore window

So, my only point here was then you ONLY need disable the shift key stuf
WHEN YOU create the mde...not during regular development (since, as pe
above...is very quick to test start-up options..and then go back t
development mode and use the shift-bypass)

So, only disable the shift key by-pass in the mde.....

-
Albert D. Kallal (MVP
Edmonton, Alberta Canad
(e-mail address removed)
http://www.attcanada.net/~kallal.ms
 
Top