Front End/Back End

G

Garret

How do I disable the shift key on the .MDE? This seems to be the only
problem remaining.
 
G

Garret

Ok thanks, now where would I paste this code? (so that it runs at
startup, right?). It seems like an easy problem but I don't know what
to do.
 
R

Rick Brandt

Garret said:
Ok thanks, now where would I paste this code? (so that it runs at
startup, right?). It seems like an easy problem but I don't know what
to do.

Put it in a standard module. It needs to run exactly once, but having it
run on every startup would be harmless.
 
G

Garret

Alright, so if I put this code into the MDB before I make the MDEs, I
should be all set, assuming that I log in as an Admin each time?
Basically this code disables the shift key overall, unless it is an
admin who logs in, correct?
 
R

Rick Brandt

Garret said:
Alright, so if I put this code into the MDB before I make the MDEs, I
should be all set, assuming that I log in as an Admin each time?
Basically this code disables the shift key overall, unless it is an
admin who logs in, correct?

The code sets a property on the database that disables the shift key for all
*future* instances of the file being opened. That is why it only needs to be
run once. If you run the code in startup it actually does nothing to
disable the shift key until the file is opened at least once without using
the shift key. Unless you think someone is actually going to try the shift
key the very first time they open the file then that should work. If you
are worried about that then YOU can open it without the shift key before you
distribute it.

Also, it disables the shift key for ALL users, even those with administrator
permissions. However those users would be allowed to run another code
routine that would re-enable the shift key whereas a user without
administrator authority could not do so. This assumes you are also setting
up User Level Security on the file.
 
G

Garret

I tried testing this on backup copies, and every time I tried to build
the MDE after inserting the code, it gives me a message box that tells
me it was unable to build the MDE. I deleted the module containing the
code, and I could construct the MDE afterward, so it must be the source
of the problem. Am I doing this in the correct order:

- Split original database
- Insert code into MBD
- Create MDE

And this is all done without opening or closing anything.
 
R

Rick Brandt

Garret said:
I tried testing this on backup copies, and every time I tried to build
the MDE after inserting the code, it gives me a message box that tells
me it was unable to build the MDE. I deleted the module containing
the code, and I could construct the MDE afterward, so it must be the
source of the problem. Am I doing this in the correct order:

- Split original database
- Insert code into MBD
- Create MDE

And this is all done without opening or closing anything.

After inserting the code do a compile on the entire project. Access should
find and highlight any rows in the code that won't compile. Those errors
have to be corrected before you will be able to make an MDE.
 
G

Garret

I did a "Compact and Repair" (if thats what you meant by compile) on
the MDB after inserting the code, which happened successfully. Then I
tried to create the MDE and I still got the same message box that said
I was "unable to create an MDE database". Did I insert the code too
early anywhere or should I have run/not run the code?
 
R

Rick Brandt

Garret said:
I did a "Compact and Repair" (if thats what you meant by compile)

No, I mean compile. It's found in the Debug menu of the Menu bar when in a
code module.
 
G

Garret

I did that...sure enough it hit an error on the first line of real code
for the module that says:

Function ChangePropertyDdl(stPropName As String, _
PropType As DAO.DataTypeEnum, vPropVal As Variant) _
As Boolean

It errors me: "User-defined type not defined"

I'm clueless again...I copied and pasted the code in my module from the
link you previously posted, so there couldn't be anything missing.
 
R

Rick Brandt

Garret said:
I did that...sure enough it hit an error on the first line of real
code for the module that says:

Function ChangePropertyDdl(stPropName As String, _
PropType As DAO.DataTypeEnum, vPropVal As Variant) _
As Boolean

It errors me: "User-defined type not defined"

I'm clueless again...I copied and pasted the code in my module from
the link you previously posted, so there couldn't be anything missing.

It looks like that code requires a reference to the DAO library. If you go
to Tools - References is the DAO library one of the "Checked" ones? This
would be checked by Default in Access 97 and Access 2003, but not in Access
2000 or 2002.
 
G

Garret

I couldn't find a DAO on the list of things, but the ones that were
checked were:

Visual Basic For Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Bennet-Tec MetaDraw Control
 
R

Rick Brandt

Garret said:
I couldn't find a DAO on the list of things, but the ones that were
checked were:

Visual Basic For Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Bennet-Tec MetaDraw Control

Well, you have to scroll down the list of unchecked items until you find the
one for DAO 3.6 and check it. Then that code should compile.
 
G

Garret

Oh, it had the word Microsoft before it so I didn't find it right away.
Anyway, that worked and it compiled without any problem. I then made
the MDE, but I can still see the "normal" access interface while
holding the shift key during startup.
 
R

Rick Brandt

Garret said:
Oh, it had the word Microsoft before it so I didn't find it right
away. Anyway, that worked and it compiled without any problem. I
then made the MDE, but I can still see the "normal" access interface
while holding the shift key during startup.

Did you actually "run" the code? It is not enough for it to simply exist.
An again if you set something up to run it in Startup then it will only have
an effect after it has been run once.
 
G

Garret

I thought that all modules run automatically when the program starts,
no? If not, how do I run the code?
 
R

Rick Brandt

Garret said:
I thought that all modules run automatically when the program starts,
no?

No. Modules are where you create custom code to "do stuff". It wouldn't
make much sense for all of the "stuff" to just fire off every time you open
your file.
If not, how do I run the code?

In a module you have functions and subs. The code you downloaded consists
of two functions. On ethat creates and sets a custom databse property and
one that does the same thing in a manner such that only users with
Administer authority on the database can change the settings on that
property once it is set.
 
G

Garret

Rick said:
No. Modules are where you create custom code to "do stuff". It wouldn't
make much sense for all of the "stuff" to just fire off every time you open
your file.

I usually declare global variables in there, so I thought the code runs
at startup so that all the variables are created as soon as possible to
be used anywhere.
In a module you have functions and subs. The code you downloaded consists
of two functions. On ethat creates and sets a custom databse property and
one that does the same thing in a manner such that only users with
Administer authority on the database can change the settings on that
property once it is set.

Right, but how do I get these functions to fire off like you said?
 
G

garret

I've read some Microsoft help sites, and they say to insert some of the
code in a commandbutton's click event to get it to fire off, is this
what you had in mind also?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top