Problems closing and loading forms with speech recognition

I am using the microsoft direct speech recognition package to create a voice command system and I am having problems opening forms. The system recognises the commands correctly but using the code below won't open the form:

Unload Me
students.Show vbModal

If I put the same code in a command button it works fine. However, when I say "Students" the main form 'me' unloads and thestudents form doesn't load.

Please help, I can't figure this out.

Thanks
liseperuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

codeconquerorCommented:
You're unloading your form before calling the Show method.  You need to have the Form_Load() event of the students form unload the current form.

Try this instead:

Me.Hide
students.Show vbModal
Unload Me
codeconquerorCommented:
Woops, put 2 different thoughts in 1 post.  Screwy day.  :P

Just change your code to this:

Me.Hide
students.Show vbModal
Unload Me

and it will work.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
liseperuAuthor Commented:
you're right, it works.
Thanks a lot

Why did it work with a command button though?
codeconquerorCommented:
It just depends on the order in which the events fire.  They fired in a different order when you clicked the command button, possibly because of a DoEvents call or something like that.
liseperuAuthor Commented:
ok. Thanks. I didn't know that. That will be useful to know:)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.