combo box

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

Guest

My code:

Private Sub Command12_Click()
Combo6.SetFocus
Combo6.AddItem , 0 = Val(Text10.Text)
End Sub

Can someone send correct code so that after user enters text into a textbox
control and then clicks the command button, it adds the entry to the bottom
of the list in the combo box?

~thank you
 
first, the additem value should be a string, not a number. It appears you
are trying to add it to the top of the list, but your code is incorrect.
What it is trying to do now is add a numeric value based on whether the value
of Text10 is 0. If it is 0, it will try to add -1 to the list. It not, it
will try to add 0 to the list. Also, the text property is only valid if the
control has the focus. The syntax would be correct for VB6, but not for
Access VBA. All you need is the name of the control.

Try this:
Combo6.AddItem Me.Text10, 0
 

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

Back
Top