Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update record using Combo Box Selection

Status
Not open for further replies.

efiftythree

IS-IT--Management
Jan 13, 2006
27
0
0
US
I am working on a database to record information about phone extensions on our phone switch. I have a table with three columns:

Code:
--------------------
| ID | EXT | INUSE |
|----|-----|-------|
| 1  | 243 |   1   |
| 2  | 192 |   0   |
--------------------

ID is the record ID, EXT is the extension number, and INUSE is either a 1 for used or 0 for unused.

I built a query that populates a combo box on a form with only the unused extensions. I want to be able to select an extension from that list and hit a button which will in turn update the INUSE field to a 1 for that extension in the table above.

I’ve searched and I can’t seem to find a starting point. Can someone point me in the right direction please :) Thanks!!!
 
Very simple.

I'm assuming your combo has the ID field and the INUSE field as it's columns, at a minimum. If the BOUND column is ID, do this:

DoCmd.RunSQL "UPDATE your-table SET INUSE = 1 where ID = & your-combo-box-name

e.g.
Code:
DoCmd.RUNSQL "Update tblPhones set tblPhones.InUse = 1 Where tblPhones.ID = " & myComboBox

You need the ID field in your combo box so we can find the matching record in the table to update it. Got it?




"For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled." - Richard P. Feynman
 
Thank you WildHare. I am working on building the database portion up a bit then I am going to move back to the forms. I will let you know if it works. THANKS!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top