inputbox for a combobox (easy)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Any way to set up an inputbox prompt to fill in a combobox. I want an
inputbox to ask for a name. When I input the name I want the combobox to
show that name.
 
in message:
Any way to set up an inputbox prompt to fill in a combobox. I want an
inputbox to ask for a name. When I input the name I want the combobox to
show that name.

Something like so??
(I put this on a command button click event)

Private Sub cmdPrompt_Click()
On Error GoTo ErrorPoint

Dim varPrompt As Variant

varPrompt = InputBox("Please enter a name.", "Enter Name")

' Name of my combo box is cboSomeName
Me.cboSomeName = varPrompt

ExitPoint:
Exit Sub

ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub
 
Thanks again

Jeff Conrad said:
in message:


Something like so??
(I put this on a command button click event)

Private Sub cmdPrompt_Click()
On Error GoTo ErrorPoint

Dim varPrompt As Variant

varPrompt = InputBox("Please enter a name.", "Enter Name")

' Name of my combo box is cboSomeName
Me.cboSomeName = varPrompt

ExitPoint:
Exit Sub

ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub
 
Back
Top