Results 1 to 9 of 9
  1. #1
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151

    Combo Box field selection help needed

    I have a couple comboxes on the form.
    I cannot get the highlight value to add to the table. It is always the 1st one, even thou I have highlighted a different client.



    My value for & Me!ClientID & is the 1st one not the highlighted one.
    My value for & Me!FSWID & is the right one.

    I need the ClientID to be the highlight value any suggestions on how.
    I included some pictures to help show the problem.

    Thx Russ

    "
    If rs!Inactive = False Then
    sql = ("insert into TicklerData(TicklerID,ClientID,FSWID,Item,Due,Sort Order) values (" & maxid & "," & Me!ClientID & "," & Me!FSWID & ",'" & rs![Item] & "','" & DateDue & "'," & rs![SortOrder] & ");")
    DoCmd.RunSQL (sql)
    End If

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Me!ClientID is pulling data from the form, not the combo. Try using

    Me.ClientSelectBox
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151

    syntax blues

    How would you write that like:

    Me.ClientSelectBox.ClientID
    or
    Me!ClientSelectBox!ClientID
    or
    ??


    Last try that failed - Me!ClientSelectBox.ClientID
    see below

    If rs!Inactive = False Then
    sql = ("insert into TicklerData(TicklerID,ClientID,FSWID,Item,Due,Sort Order) values (" & maxid & "," & Me!ClientSelectBox.ClientID & "," & Me!FSWID & ",'" & rs![Item] & "','" & DateDue & "'," & rs![SortOrder] & ");")
    DoCmd.RunSQL (sql)
    End If

    I think you are on the right track.

    Thx
    Russ

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I'd write it exactly as I suggested:

    Me.ClientSelectBox

    Presuming the bound column of the combo is the client ID, that should work.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151
    Method or Data member not found message with this

    If rs!Inactive = False Then
    sql = ("insert into TicklerData(TicklerID,ClientID,FSWID,Item,Due,Sort Order) values (" & maxid & "," & Me.ClientSelectBox & "," & Me!FSWID & ",'" & rs![Item] & "','" & DateDue & "'," & rs![SortOrder] & ");")
    DoCmd.RunSQL (sql)
    End If

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Based on the picture of the property sheet you posted above, that's the name of the combo. Has it changed? That should be whatever the name of the combo is.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151

    Still trying to get the right variable name

    The property sheet has not changed.

    I do not understand the field name you describe to use, is this:
    " Me.ClientSelectBox "

    That is the name of the whole Combo Box, not a particular field within it. I need the query to point the field Clientid within the combo box. So, shouldn't the field name be more like:
    "Me.ClientSelectBox.Clientid " ?

    Thx for the help.
    Russ - Rneuman @ Scaninc.org

  8. #8
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151
    You are correct! No wonder you have the famous MVP by your id.

    All I needed was the: " & Me.ClientSelectBox & "
    I must be a sequence thing. That it was updating the table field Clientid and then some since the field name in the table was Clientid and there was a Clientid in the ClientSelectBox there was a match and that field from the ClientSelectBox was picked.

    Thanks for the help.

    Russ

  9. #9
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    No problem Russ; glad you got it sorted out. FYI, to reference a particular field within the combo, you do it by column:

    Me.ComboName.Column(x)

    where x is the desired column (it is zero based). But as you've found, you don't need to do that to get the bound column.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 13
    Last Post: 11-25-2009, 03:10 PM
  2. Checking List Box Value with Combo box selection
    By empyrean in forum Programming
    Replies: 1
    Last Post: 10-23-2009, 06:01 PM
  3. Replies: 1
    Last Post: 08-26-2009, 10:45 AM
  4. Replies: 3
    Last Post: 02-26-2009, 10:17 AM
  5. Replies: 0
    Last Post: 04-17-2008, 09:24 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