Results 1 to 2 of 2
  1. #1
    svalentine is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    1

    Assigning value to combobox not selecting the item in the combobox

    I have a combobox with a query as it's row source. I'm trying to assign a value to the combobox via VBA and then run an After Update procedure to set the values of fields to different columns in the combobox for the row that the string corresponds to.

    The after update procedure works when i click the dropdown and select a value from the combo.

    The VBA works to take a variable string and assign it to the combobox as it's value. However, when the string is assigned to the combo the corresponding row is not actually being selected and therefore an After Update procedure is not being run.

    After I assign the string value to the combo, if I click the drop-down, the row I would like to return is highlighted, but nothing happens until i press the enter key.



    Let me know if you need more specifics, the bulk of my code for what goes into the combo is below. The combo is Val1GnSched. The string I'm assigning is "CurrGroupSched"

    Code:
        CurrGroupSched = ""
    
            For CurrAcc = 1 To AccCount
                If Me("V1Group" & CurrAcc).Value = CurrGroup Then
                    CurrGroupMV = CurrGroupMV + Me("MV" & CurrAcc).Value
                    If CurrGroupSched = "" Then
                        CurrGroupSched = Me("V1Sched" & CurrAcc).Value
                    ElseIf CurrGroupSched <> Me("V1Sched" & CurrAcc).Value Then
                        MsgBox ("sample")
                        Exit Sub
                    End If
                End If
            Next CurrAcc
    
            Me("Val1G" & CurrGroup & "Sched").Value = CurrGroupSched

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,598
    You say 'set the values of fields to different columns in the combobox'. Why are you saving this related data to another table? This appears to be duplicating data.

    Why not use expressions in textbox ControlSource that reference the combobox column index:

    =[comboboxname].[Column](x)

    Index begins with 0 so column 2 will be index 1.
    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: 7
    Last Post: 01-09-2014, 09:52 AM
  2. Combobox selecting one available option
    By dylcon in forum Forms
    Replies: 4
    Last Post: 06-18-2013, 01:28 PM
  3. Selecting a combobox item with VBA
    By tylerg11 in forum Forms
    Replies: 6
    Last Post: 04-19-2012, 12:30 PM
  4. Replies: 5
    Last Post: 06-10-2011, 03:31 PM
  5. Selecting text - ComboBox
    By Numbat in forum Programming
    Replies: 2
    Last Post: 06-05-2006, 05:42 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