Hey guys,
i would like to add a value that i choose from a combo box to a table by clicking a button after selecting it from the combo box, and i do not know how to do it, can someone please help me with it?
Sandhya
Hey guys,
i would like to add a value that i choose from a combo box to a table by clicking a button after selecting it from the combo box, and i do not know how to do it, can someone please help me with it?
Sandhya
By value, what do you mean, If not in list then add it?
Are you entering a value in combobox that is not in the list? If what you need to do is add an item to the combobox RowSource, review http://support.microsoft.com/kb/197526
Or are you selecting item from list and want to add another record to a table?
Why would you need to do this? Maybe really need a form/subform arrangement.
However, consider:
CurrentDb.Execute "INSERT INTO tablename(fieldname) VALUES(" & Me.combobox);
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks for getting back to me. I don need to add an item which is not in the list, i need to add an item from the list in the combo box to a new table.
Is this the only thing you will use this combo for, otherwise it makes no sense to do it this way! Is this combo putting a value of some kind in another field? Need more information.
???? Where do the values in the combo box come from???
Tell us more about your table, the combo box and what exactly you are trying to do.
A sample might help.
Guys,
The combo list is getting values from some other table and it needs to insert the values which are only chosen by the user to another table, kind of like filtering, i got this figured out, thanks for your help. Now after inserting a value in the table, that value should not appear in the combo box again. Is there a way you can do it? Would really appreciate the help.
I think you should tell the readers what you are trying to do in plain English. What you are asking is something that doesn't seem too common. Perhaps the readers will have some options for you once they understand your intent.
OK, it is a user login approval function, when a user registers for an account the user name goes into a table and the values in this table are generated in a combo box in a user form, the admin will select the users who he wants to give access to from this combo box and give his approval for access, this is what it is about. Now i am done with the approval function, i just want to know how to make username disappear in the combo box after the admin selects the username and approves it.
Presume a form is open to account records. Combobox RowSource could be a query that joins User table with the account assignment table with filter criteria that shows users not assigned to account number of the form's current record. Have code in the combobox AfterUpdate event to requery the combobox after a user is selected.
If you want to provide db for analysis, follow instructions at bottom of my post.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thank you. But would you please tell me how to add an after update event for a combo box? i am new to MS Access.
In design view, select the object or a control, view property sheet Event tab. In the desired event select [Event Procedure]. Click the ellipses (...). This will open the VBA Editor at the procedure. Type code. However, correction, don't think the AfterUpdate of combobox is appropriate because really don't need to modify the list until the record is committed. Should probably be form Current event.
Me.comboboxname.Requery
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.