Results 1 to 9 of 9
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Custom MsgBox command? (A2k (9.0.3821) SR-1)

    Custom MsgBox command?
    A2k (9.0.3821) SR-1

    Is there any such thing as a custom msgbox command that can give the user choices like?

    Red Blue

    Instead of

    Yes No

    Any help would be appreciated.

    Thanks, John

  2. #2
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom MsgBox command? (A2k (9.0.3821) SR-1)

    Check out this <post#=129656>post 129656</post#> and the associated thread.

    Hope this helps.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom MsgBox command? (A2k (9.0.3821) SR-1)

    Hi Tom

    Great work!

    Will this work with run time?

    Thanks, John

  4. #4
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom MsgBox command? (A2k (9.0.3821) SR-1)

    I can't answer for sure as I'm not equipped for producing runtime apps, but it's fairly basic stuff, so I would think that it would. Anyone willing to give it a try?

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Custom MsgBox command? (A2k (9.0.3821) SR-1)

    If it's a normal Access form then it should work perfectly well in a runtime app. You can always make a rough test by using the /runtime command line argument. You won't find it in the help files, but if you use a shortcut or use the Run selection from the Start menu, you can enter the full path to the Access executable plus a space and the full path to the database you want to open plus a space and then "/runtime" (without the quotes). It isn't a complete runtime environment, but it will allow you to test whether your commandbars and menus work and you won't be able to see the database window or break into code.
    Charlotte

  6. #6
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom MsgBox command? (A2k (9.0.3821) SR-1)

    Hi Charlotte

    Reason I ask, code includes following, thought I read somewhere this was a limitation in run time

    ' Open form in design mode and hidden to configure based on arguments above
    DoCmd.OpenForm "frmMessageBox", acDesign, , , , acHidden

    John

  7. #7
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom MsgBox command? (A2k (9.0.3821) SR-1)

    Hi Tom

    Code works like a champ, this should be part of access, I can now do with 1 message what it use to take me 2 sometimes 3 msgbox to communicate to and guide a user in the right direction, not to mention some developers are using multiple forms with custom buttons for dialog.

    I will be needing 4 or 5 button in the future, I can see where most of the code has to be replicated, however the following is confising to me:

    ' Set focus to default button (it must be visible)
    strOpenArg = "0"
    If ((lngFlags And 256) > 0) And ((intButtons And 2) > 0) Then
    strOpenArg = "2"
    ElseIf ((lngFlags And 512) > 0) And ((intButtons And 4) > 0) Then
    strOpenArg = "3"
    ElseIf ((intButtons And 1) > 0) Then
    strOpenArg = "1"
    End If

    How would the above be changed to accommodate a forth button?

    Thanks, John

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Custom MsgBox command? (A2k (9.0.3821) SR-1)

    You'd have to test it but I believe the limitation is on MDEs rather than runtime. You can't make design changes in an MDE at all. We distribute runtime versions all the time and use code to change and save the printer settings for reports, so I think you'll be OK.
    Charlotte

  9. #9
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom MsgBox command? (A2k (9.0.3821) SR-1)

    John,

    This segment of the code sets up an opening argument for the form which is used to set the focus on one of the buttons (simulating MsgBox's vbDefaultButton1, vbDefaultButton2, and vbDefaultButton3). The code checks if you're using the button (e.g., ((intButtons And 2) > 0) for the second button) and if that button should be the default (has focus on form open); e.g. ((lngFlags And 256) > 0). If both are satisfied, then the opening argument is set to the button number (e.g., "2"). Note that vbDefaultButton2 = 256 and vbDefaultButton3 = 512; I guess the code would have been more readable if I used the Access constants rather than their values.

    If you are adding more buttons and you (may) want one of them to be the default, then add ElseIf clauses for each. You'll need to decide on values (lngFlag bits) to indicate you want the 4th or 5th button as the default (I'd suggest values of 1024 and 2048, respectively). For example:
    <font face="Georgia">
    ElseIf ((lngFlags And 1024) > 0) And ((intButtons And 8) > 0) Then
    strOpenArg = "4"
    ElseIf ((lngFlags And 2048) > 0) And ((intButtons And 16) > 0) Then
    strOpenArg = "5"
    </font face=georgia>
    (Curiously, Access has a vbDefaultButton4 constant defined, but its value is 768 which equals VbDefaultButton2+vbDefaultButton3. vbDefaultButton5 is not defined.)

    Note that your 4th and 5th buttons will have to be named 'cmdButton4' and 'cmdButton5', respectively, for the Form_Open routine to work.

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •