Use combo box that also updates table

bakerboy_1111

Registered User.
Local time
Today, 09:06
Joined
Dec 1, 2003
Messages
43
Hello All,

I was trying to design a query that looks up values from a table and allows the user to select from a combo box. This part is farily straight forward.

I would like to extend this so that I can also type in a value into the combo box, and have it update the table it was choosing from.

I'm sure this is possible, and most likely fairly simple. can anyone please help me with this?
 
Bakerboy,

This is way easier than your other post.

In the NotInList event for your combo, you
can put:

Code:
Dim dbs As Database
Dim sql As String

sql = "Insert Into ThatTable (SomeField) " & _
      "Values ('" & Me.Combo & "')"
dbs.Execute(sql)
Me.Combo.Requery

Wayne
 
Thanks again Wayne,

I'm not sure where you mean for me to enter the code.

The combo box is within the query, so when I right click on the query, there is no event box. How do I get to this?

Cheers,

Bakerboy
 
Baker,

Get your form in design view, right-click on the combo box,
choose properties, and in the NotInList event, put the code.
A query is the rowsource for the combo, right? That's why
the last thing to do is Requery the combobox so that the
new value is included.

Wayne
 
The thing is I don't have a form at all. The combo box is just within the query.

I suppose, though, now that I think about it, I could reproduce the same structure of the query in a form. That wouldn't be too much trouble.

Cheers,

Bakerboy
 

Users who are viewing this thread

Back
Top Bottom