Can I move the focus to the No button in a Msgbox?

D

David Anderson

A standard Access 2000 Msgbox with Yes and No buttons always opens with the
focus on the Yes button. Is there any way to move the focus to the No
button? I can't see anything about this in the online help, so I'm not very
optimistic....

David
 
M

Marshall Barton

David said:
A standard Access 2000 Msgbox with Yes and No buttons always opens with the
focus on the Yes button. Is there any way to move the focus to the No
button? I can't see anything about this in the online help, so I'm not very
optimistic....


Use the Default constants to specify that:

MsgBox " ... ", vbYesNo + vbDefaultButton2, ...
 
D

David Anderson

Hi Marshall,
Thanks, as always, for your prompt and useful assistance. My Msgbox now
works the way I want. I will have to learn more about these VB constants....

David
 
A

Arvin Meyer [MVP]

David Anderson said:
Hi Marshall,
Thanks, as always, for your prompt and useful assistance. My Msgbox now
works the way I want. I will have to learn more about these VB
constants....

Open any code window, go to View >>> Object Browser and type in "constants"
without the quotes into the search window.
 
M

Marshall Barton

While you're in the VBE, check Help for the MsgBox function
to see all the constants that can be used with the function.

And, as Arvin pointed out, the Object Browser can be very
handy.
 
D

David Anderson

I am embarrassed to say that I DID look at the online help before starting
this thread - and never saw the references to vbDefaultButton1,
vbDefaultButton2, etc. I have been putting off an eye test for several
weeks. It now looks likely that I need new glasses (or a new brain).

David
 
A

Arvin Meyer [MVP]

Your brain is fine. The online help is difficult to use and may not have
everything you need. That's why both I and Marsh mentioned the Object
Browser. There may not be a complete explanation, but usually, there's
enough to figure out how to proceed.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

David Anderson said:
I am embarrassed to say that I DID look at the online help before starting
this thread - and never saw the references to vbDefaultButton1,
vbDefaultButton2, etc. I have been putting off an eye test for several
weeks. It now looks likely that I need new glasses (or a new brain).

David
 

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