Self contained utility which allows custom-designed InputBoxes, complete with demonstration. Has the advantage over forms in that it waits for user input, and suspends the macro, just like InputBox - yet it uses ordinary forms for the display.

For more information, contact:

Darren Reynolds
Anglopean Ltd
Suite 25, 29 Notting Hill Gate
LONDON
W11 3JQ
England

Ph: +44 71 404 2227
Fx: +44 71 405 9194
C$: 100277, 2270


Usage:
=====

Design a form as normal. Set the form`s popup and modal properties to "Yes", and be sure to include at least an "OK" button. You may add as many buttons as you wish. Try to conform to the standard "OK", "Cancel", "Yes", "No" etc. buttons if you can, but the beauty is that you don`t have to if you don't want to.

The OK button's OnPush property should read =UI_InputPush(1), the Cancel button's OnPush property =UI_InputPush(2) etc., following the Access MsgBox convention where possible. So, a "No" button would be =UI_InputPush(7).

The form's OnClose property should read =UI_InputNoClose(), which prevents a close of the form until one of the buttons has been pushed.

The UI_Input (<FormName>) function opens the form, and returns a value according to which button was pushed. You are then responsible for closing the form. So, a typical macro would look like this:

RunCode
  UI_Input ("MyFormName")

SetValue
   Forms!AnotherForm!SomeControl
   Forms!MyFormName!MyControl1

SetValue
   Forms!AnotherForm!SomeOtherControl
   Forms!MyFormName!MyControl2

Close
   Form
   MyFormName


If you want to take this a stage further and make use of the function's return value, I recommend you use Access BASIC. You could write something like this:

Select Case UI_Input("MyFormName")
 Case MB_OK         'constant value 1
  Rem OK pushed
  DoSomethingUseful Forms!MyFormName!SomeControl
  DoCmd Close A_FORM, "MyFormName"
 Case MB_Cancel     'constant value 2
  DoCmd Close A_FORM, "MyFormName"
  MsgBox "You pushed Cancel"
End Select

If DoSomethingUseful is going to take a while, you might want to use the Hourglass until you can close your form. (You can't close it right away because you need to get the user's input off it.)