Forum Discussion

PercyPercian's avatar
PercyPercian
Copper Contributor
Oct 19, 2026
Solved

Setting value to a second column of a ComboBox not Showing

Hello everyone!

 

There's a combobox (cboPurDate) in a form (Purchasing) as follows:

Row Source (cboPurDate): 

SELECT DISTINCT Purchasing.PurDate, Format([PurDate],"0000\/00\/00") AS [Purchasing Date] FROM Purchasing ORDER BY Purchasing.PurDate;

Bound Column: 1

Column Count: 2

Column Widths: 0";1.25"

After Update Event: Requery

 

Row Source of form (Purchasing): 

SELECT Purchasing.*, Purchasing.PurDate FROM Purchasing

WHERE Purchasing.PurDate Like [Forms]![NavigatioinForm]![NavigationSubform].[Form]![cboPurDate] & "*" ORDER BY Purchasing.PurDate DESC;

 

There's also a piece of code to set a value to cboPurDate:

Me.cboPurDate= Null

Me.cboPurDate.Requery

Me.cboPurDate= 20261019

Me.cboPurDate.Requery

Me.cboPurDate.Column(1) = 20261019       'Added to display the new value to not showing combobox which leads to err

Me.Requery

 

After setting a new value of 20261019 to the first column of combobox, the related record in the underlying recordset is shown but the combobox itself. Thus, the same value is set to the second column which leads to Run-Time error '424': Object required.

 

Please advise!

Many thanks

  • All you need is to bind the first column:

    Bound Column: 0

    Then set the Value and requery the form:

    Me!cboPurDate.Value = 20261019
    Me.Requery

2 Replies

  • Gustav_Brock's avatar
    Gustav_Brock
    Iron Contributor

    All you need is to bind the first column:

    Bound Column: 0

    Then set the Value and requery the form:

    Me!cboPurDate.Value = 20261019
    Me.Requery
  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor

    There are two things about this that have a bearing on the problem. 
    First 20261019 doesn't look like a date value to me. It looks like a string of digits which happen to correspond to the digits in YYYYMMDD. That is to say, it's looks like a string formatted representation of a date. Since you don't show us how it gets formatted, we can't really do more than guess at that.


    The second thing is that you are trying to set the second column in the combo box to that value in VBA. I don't know what that would accomplish, but I doubt that's really what you are aiming to accomplish. 

    Columns in a combo box are Indexed, from left to right, starting at 0. That means the first column is actually column(0). Typically the bound column is that first column, Column(0). Trying to set some value for the second column isn't a valid thing to do. 

    So, my guess is that you are trying select that date value, which itself already seems problematic because of the formatting.


    One or both things could be involved here. Please provide details about the issues raised so we can try to help figure out where it is going wrong.