Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

Customizing MsgBox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Hallett - 06 May 2007 22:56 GMT
MsgBox is very useful but is limited by the selection of buttons available.  
In the context in which I am using it, ‘Retry’ and ‘Proceed’ would be the
ideal buttons to display, making ‘Retry’ and ‘Cancel’ look a distinctly odd
combination.  Is there a way of changing the button captions?  (I would be
happy to service ‘Proceed’ as vbCancel since the user would be unaware of the
stratagem.)

One possible alternative is to create a form with the necessary message text
and buttons of choice but the difficulty then is to pause the principal form
VBA while the button selection is being made.  A common solution is to
transfer any subsequent code to the buttons on the second form, which can
thus be used to perform the required functions, according to the selection
made, including closure of the principal form.  However, ‘Retry’ involves
rerunning the principal form code, making iteration from the secondary form
quite difficult.

Has anyone got any good ideas?

Signature

Peter Hallett

Ofer Cohen - 06 May 2007 23:16 GMT
You can create a form as a meesage box, and when you open it using the
OpenForm command line, add to it acDialog, that will stop the code until you
close the form

Docmd.OpenForm "FormName", , , , ,acDialog

Signature

Good Luck
BS"D

> MsgBox is very useful but is limited by the selection of buttons available.  
> In the context in which I am using it, ‘Retry’ and ‘Proceed’ would be the
[quoted text clipped - 13 lines]
>
> Has anyone got any good ideas?
Baby Face Lee - 06 May 2007 23:22 GMT
Hi there,
I'm not expert in Access but as far as I'm aware you may not customise the
name of the buttons for a MsgBox (beyond selecting one of the preset options).
However, if you should decide to design your own form you can specify that
it's a dialogue box from within the code that's calling the OpenForm method.  
This would halt the procedure until one or other button is clicked.
The code would be something like:

DoCmd.OpenForm "frmName", , , , , acDialog

Hope this helps,

Lee

> MsgBox is very useful but is limited by the selection of buttons available.  
> In the context in which I am using it, ‘Retry’ and ‘Proceed’ would be the
[quoted text clipped - 13 lines]
>
> Has anyone got any good ideas?
fredg - 06 May 2007 23:25 GMT
> MsgBox is very useful but is limited by the selection of buttons available.  
> In the context in which I am using it, ʽRetryʼ and ʽProceedʼ would be the
[quoted text clipped - 13 lines]
>
> Has anyone got any good ideas?

There is no method available to change the MsgBox button captions.

Create your own form as suggested in your second paragraph.
You are mistaken about not being able to pause code execution until
the form is acted upon.

Have an unbound text control on the form.
Code the Proceed Command button:
Me![TextControlName] = 1
Me.Visible = False

Code the Retry Command Button:
Me![TextControlName] = 2
Me.Visible = False

Then in the code used to open the message form, use:

DoCmd.OpenForm "MessageForm", , , , , acDialog
If forms!MessageForm!TextControlName = 1 Then
    ' Do the Proceed stuff
Else
    ' Do the Retry stuff
End If
DoCmd.Close acForm, "MessageForm"

All code processing will stop until one or the other button is
clicked.
   



Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Baby Face Lee - 06 May 2007 23:42 GMT
Fred,

I know this isn't 'my' thread - I just replied above - but I'm interested in
your response as I can't see why you need to create the two hidden text boxes
when the form is opened as acDialog.  Wouldn't you just add the proceed code
to the onclick event of the Proceed button etc...?
Just curious.  Or am I missing something here?! :-)

Lee

> > MsgBox is very useful but is limited by the selection of buttons available.  
> > In the context in which I am using it, ʽRetryʼ and ʽProceedʼ would be the
[quoted text clipped - 44 lines]
>
>  
fredg - 07 May 2007 01:57 GMT
> Fred,
>
[quoted text clipped - 54 lines]
>>
>>  

There is only 1 text box .
It's used so that it's value of 1 or 2 (which is determined by which
command button is clicked) can be read by the code.
You don't want the code in the message form, you want that code in the
event that is used to open the message form, and which most likely
contains other data needed when the code continues, such as opening a
report using a where clause.
Not only that, but the message form can be adapted for other messages
and opened from other code where the button captions might then be
changed. The follow up code in the message form would not be
pertinent.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Graham R Seach - 07 May 2007 03:39 GMT
Peter,

Try this:
   http://www.pacificdb.com.au/MVP/Code/XMsgBox.htm

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

> MsgBox is very useful but is limited by the selection of buttons available.  
> In the context in which I am using it, ‘Retry’ and ‘Proceed’ would be the
[quoted text clipped - 13 lines]
>
> Has anyone got any good ideas?
Peter Hallett - 07 May 2007 06:34 GMT
Could I thank everyone for the usual helpful responses?  It would seem that a
satisfactory solution is indeed possible.  Unfortunately, it is also appears
that I have got quite a lot of unnecessary code lurking in my 6Mb database!  
It should be significantly slimmer in a week or two's time.  I had better get
in a large stock of coffee.
Signature

Peter Hallett

> Peter,
>
[quoted text clipped - 23 lines]
> >
> > Has anyone got any good ideas?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.