Results 1 to 10 of 10
  1. #1
    JoelBR is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    12

    Save value from combo box to table

    Hi, I have been looking an example how can I save unbound combo box value to the corresponding table without luck. I am using unbound combo box because I want to control the saving with a button.



    Can Anyone help me with this issue or give me the correct direction?

    I already have the form to get data from table, but I have some problems to save data to tables from the combo boxes and text box.
    Attached Thumbnails Attached Thumbnails Torque Relationship.PNG   Torque combo box.PNG  

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    What is the purpose of table "tblFastner"? It has only one field, the PK..?????
    I would remove it.

    Using VBA, you will need to create the SQL insert string. (an append query)
    Google "INSERT INTO"

  3. #3
    JoelBR is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    12
    I was trying to use one table to link an Id to all other tables but I could use only the tblFastenerType.

    The problem I have is how to save the information selected on all combo boxes if each of them sould be saved on different tables. I was trying to save them using a qry that include all the information from each table.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    What dose the image with the combo boxes represent? One record?

    You have 5 combo boxes on the form. Do you have to make a selection in the first combo box before you can make a selection in the second combo box?

  5. #5
    JoelBR is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    12
    Yes, the combo boxes represent only one record, they are cascade combo boxes, each combo depends of selection on previous combo except the fist one and the valMax and valMin that are textbox.
    I trying that once selected the values for that record on each combo box I press the save button and the value selected on each combo box be saved on corresponding table. I want to control the saving that is why I am using unbound combo boxes.

    I hope this clarify more my idea.

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You need another table - one that stores the PK from each of the combo boxes, plus the text fields for the (4?) torque values/comments.

    The tables you show from the structure pic are look up tables, be it cascading or other wise.
    Using unbound control requires a lot more work to save the values (VBA code) as opposed to bound controls, but that is up to you.

  7. #7
    JoelBR is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    12
    I was trying to use one query that include the information from all lookup tables related between them and use it as the intermediate table to save data on corresponding table.
    My problem is how can I do that considering the values come from combo boxes and each one has their own PK. Is there any sample database I can study and see how can data saved from unbound combo boxes?
    I was trying to use unbound controls because I want that data be saved only when the save button be pressed.

    I will apreciate if you can show me an example how can I use code to save data from any unbound combo box control to the tables. I hope this help to understand what I want to do.
    Last edited by JoelBR; 12-10-2012 at 09:49 AM.

  8. #8
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The attached dB is just an example and not guaranteed to work. Yo might want to go to microsoft.com and search for Access Templates. You can download a few and tear them apart to see how things work. I've done that a lot. The method for saving data from unbound controls is only one way to save the data.

    Hopefully this will give you some ideas of what to do.

  9. #9
    JoelBR is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    12
    Sorry for my poor understanding but I did not have a clear idea with yoour example. Can this be more explicity about the saving? I only need to know how could I save using combo boxes that is the main problem I have.

    thanks in advance

  10. #10
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    OK, but be forewarned: YOU CANNOT SAVE THE DATA BACK TO THE LOOK UP TABLES. Given the structure from post#1, you need another table!!
    You need to fix your structure before progressing.


    Here is an article on "Adding Data with Unbound Forms in Microsoft Access":
    http://www.tutcity.com/out/access/wh...ccess.7496.htm

    another article from Baldyweb:
    http://www.baldyweb.com/BoundUnbound.htm

    Here is a flash tutorial:
    http://www.datapigtechnologies.com/f...rdsnocode.html


    Here are two dBs to help explain:
    http://www.rogersaccesslibrary.com/forum/topic229.html
    http://www.rogersaccesslibrary.com/forum/topic228.html

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

Similar Threads

  1. Combo Box wont save data to Form
    By pimpzter in forum Access
    Replies: 1
    Last Post: 07-13-2012, 01:25 PM
  2. Replies: 1
    Last Post: 06-28-2012, 09:57 AM
  3. How to save cascading combo box value
    By mar_t in forum Access
    Replies: 2
    Last Post: 01-20-2011, 06:37 PM
  4. Replies: 9
    Last Post: 01-20-2011, 02:22 PM
  5. using a combo box to populate fields then save
    By crazy1701d in forum Forms
    Replies: 2
    Last Post: 05-19-2010, 07:22 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