DoEvents in 2003 mde doesn't work

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm stumped. I have a database in Access 2003 with a DoEvents command in it.
It works fine until I compile it into a mde. The mde won't allow this command
to run. I get "this command isn't available in an MDE/ADE database." It used
to be!
Some things I've read online imply this is part of the unsafe expression
protection, but I've dropped my security setting to Low. (We're well
protected from the outside without Access's help.) Does anyone know how to
get it to allow DoEvents or what I can do instead?
I'm opening a new window from a form, waiting for the user to make a choice
and then acting on the choice:
msFindme = ""
DoCmd.OpenForm "frmOrgList", acDesign, , , , acDialog
Do While msFindme = ""
'wait for user to choose an org
DoEvents
Loop
'continues on to respond to user's choice
(msFindme is set in the new window)
Thanks!
 
a) DoEvents works fine for me in an Access 2003 MDE, with Security set to
Medium.

b) Opening the second form using acDialog will cause the calling code in the
first form to pause until the second form is closed or hidden. A better
approach would be to have an 'OK' button on the second form hide that form.
The calling code will then resume, retrieve the values it needs from the
controls on the second form, and finally close the second form.
 
b)I am already opening the second form in dialog mode. It doesn't pause. It
doesn't even display the new form without the wait loop and the DoEvents
2) why am I getting this message then?
Thanks anyway
 
Whoa! Wait a minute - you're trying to open the form in design view. I
missed that. You can't open a form in design view in an MDE. That's what the
error message is complaining about, not the DoEvents.

If you take out the acDesign, you'll find that the code behaves as I
described without the DoEvents.
 
Oh my goodness, you're right! Talk about not seeing the forest for the trees!
Once I removed the "acDesign" it worked, even with the DoEvents. Thanks for
catching the obvious that I couldn't see. (Oddly enough, it wasn't opening
the form in design view, even when I ran the uncompiled version.) Thanks!
 
JoanneB said:
Oh my goodness, you're right! Talk about not seeing the forest for the
trees!
Once I removed the "acDesign" it worked, even with the DoEvents. Thanks
for
catching the obvious that I couldn't see. (Oddly enough, it wasn't opening
the form in design view, even when I ran the uncompiled version.) Thanks!

Yes, I noticed that - in an MDB, code like this ...

DoCmd.OpenForm "Form1", acDesign, , , , acDialog

.... silently ignores the acDesign argument, and opens the form in normal
form view. (But in an MDE it will raise an error). This seems like a bug to
me - when we ask Access to do something that can't be done, it should alrert
us to the fact that we've made a mistake rather than ignoring it - the
problem with the MDE is a good example of why ignoring it is not the right
thing to do. It's probably a bug we'll have to live with, though - it's
unlikely Microsoft would change it, even if they agreed it was a bug, as
changing it now would break existing code.

Just out of curiosity, though, can anyone confirm whether this happens in
earlier (than Access 2003) versions?
 

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

Back
Top