Results 1 to 12 of 12
  1. #1
    sssandhya89 is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2013
    Posts
    15

    adding a record through a combo box

    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

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    By value, what do you mean, If not in list then add it?

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    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.

  4. #4
    sssandhya89 is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2013
    Posts
    15
    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.

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    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.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    ???? 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.

  7. #7
    sssandhya89 is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2013
    Posts
    15
    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.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    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.

  9. #9
    sssandhya89 is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2013
    Posts
    15
    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.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    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.

  11. #11
    sssandhya89 is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2013
    Posts
    15
    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.

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 02-20-2013, 01:30 PM
  2. Clearing Combo Box when adding a new record
    By Purdue_Engineer in forum Forms
    Replies: 3
    Last Post: 09-25-2012, 12:57 PM
  3. Replies: 4
    Last Post: 08-14-2012, 07:14 AM
  4. Replies: 14
    Last Post: 05-25-2012, 02:40 AM
  5. Adding a record based on combo
    By cjamps in forum Forms
    Replies: 1
    Last Post: 02-24-2009, 12:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums