about getting the combobox value while the value is typed or chang

  • Thread starter Tahseena Ishrat Ahmed
  • Start date
T

Tahseena Ishrat Ahmed

Dear Group

I have a Combobox to select or enter a job number. The combo box list is
limited to a list taken from a table.

My problem is while I change or type in combo box, I want to execute the
double click event or when I press enter, I want to execute some code.

Since the focus is still on the combo box, the change event does not occur.

So every time it takes the previous value of the combo box, befor typing or
changing.

When I Double Click or press enter, I want this new value displayed in the
combobox to be available.

Is there any way, I can generate the change event or any other thing, so
that this new value can be accessed or used?
 
B

Beetle

To add new values to a combo box, you use the combo boxes
Not In List event. Here is an example of some code for this;

Private Sub cboMyCombo_NotInList(NewData As String, Response As Integer)

Dim strSQL As String

If MsgBox("Do you want to add this value to the list?", vbYesNo) = vbYes Then
strSQL = "Insert Into tblMyTable ([MyField]) values (""" & NewData & """)"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top