Results 1 to 2 of 2
  1. #1
    rmiell is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    5

    saving Combo Box selection to a table

    I have made a form to enter daily timesheet info for personnel. I have on this form a combo box with different job descriptions, with this info located in a "job description" table. Once all info is entered on this form, I want all info to be entered into my "main time table".

    It seemed to be working ok, until I printed out my report based on my main time table. In the area where my job description should be, I don't get the actual wording I had selected from the job description table (using the combo box), only the ID number.



    Can anyone provide me with the steps to have the selected text (from a combo box) saved in the recordset of another table?

    Thanks

    rmiell

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Hi rmiell!

    I suspect that your expression is using the wrong property of the combo box.

    Try something like the following.

    I have rigged up a simple example.

    I am inserting a Student Name
    From cmbStudentName on my Form
    INTO field StudentName in Table1

    This code is behind a command button on the form and fires off when the command button is clicked.

    Code:
     
    Dim StudentName, StrSQL As String
     
    Me.cmbStudentName.SetFocus
    StudentName = Me.cmbStudentName.Value
     
    StrSQL = "INSERT INTO Table1 (StudentName) "
    StrSQL = StrSQL & "VALUES (" & "'" & StudentName & "'" & "); "
     
    'MsgBox StrSQL
     
    DoCmd.RunSQL StrSQL
    Let me know if that works for you.

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

Similar Threads

  1. Replies: 8
    Last Post: 06-23-2014, 12:19 PM
  2. Form-Combo Box-Saving value to table
    By Jill in forum Forms
    Replies: 2
    Last Post: 12-06-2012, 03:13 PM
  3. Combo Box not saving to table
    By dgriffin in forum Forms
    Replies: 11
    Last Post: 06-08-2011, 03:04 PM
  4. combo box selection stored in table
    By combine21 in forum Forms
    Replies: 1
    Last Post: 12-02-2010, 09:57 PM
  5. Replies: 1
    Last Post: 08-26-2009, 10:45 AM

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