Pop-up prompt with combo box

  • Thread starter Thread starter Jonathan Blitz
  • Start date Start date
J

Jonathan Blitz

Not sure if this is even possible.

I would like to open a prompt screen from within VBA.
This is easy.

Problem is, I want the screen to display a combo box - is that possible?

If so, how?

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
Yes, You can, but must use custom dialog.

Create new form with standard buttons (OK, CANCEL) and
combobox.
Set Style property fo form = Dialog
For OK button set Default property = true
For CANCEL button set Cancel property = true
Write your code for OK and Cancel click event.

Ready!
 
My problem is that if I open the form with an OpenForm event then won't I
exit the current form?
I need control to return to the next command after form has completed.

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
Well, you will lose the focus on your current form. You can open the popup
form as a Dialog type (which suspends operations until your user handles
that form) and then return to the form which called your popup form. I do it
like this:

'on my popup form, in the General Declarations section
Private mstrForm as string

Public Property Let CallingForm (vForm As String)
mstrForm = vForm
End Property

'in the form Close event
If Len(mstrForm) > 0 Then
Forms(mstrForm).SetFocus
'and if you want to set the focus to a particular control
Forms(mstrForm).Controls(NameOfControl).SetFocus
End If

Then, in the form which calls the popup:

DoCmd.OpenForm "frmPopup",,,acDialog
Forms!frmPopup.CallingForm = Me.Name

Note that I'm not sure of the commas and such in the Openform command, but
Intellisense should tell you what you need.
 
Back
Top