Question

================================== EDIT ==================================

I had a few errors so I fix by doing the following:

Me.ADComponentNumber.RowSource = "SELECT [Components].[ID], [Components].[ComponentNumber] FROM Components WHERE [Components].[Items_Id] = " + Me.ADItemNumber.Column(0) + " ORDER BY [Components].[ComponentNumber]"

=========================================================================

I wanted to fill a combo list programatically from a Db table. I've tried a few things like settings up RowSource, but it is not working. Pls see code below:

// Basically when a user selects an item form `Item Number` combo list
// The `ADItemNumber_Change()` function is supposed to get the `Item.ID` (Column(0)) number
// and feed it to the `ADComponentNumber.RowSource`, which is then supposed to 
// fill the list with Components whose `Components.Item_ID` fields matches `Item.ID` number.
// NOTHING IS GETTING FILLED OUT IN THE LIST...
Private Sub ADItemNumber_Change()
    Me.ADComponentNumber.RowSource = vbNullString
    Me.ADComponentNumber.RowSourceType = "Table/Query"
    Me.ADComponentNumber.RowSource = "SELECT [Components].[ID], [Components].[ComponentsNumber] FROM Components WHERE [Components].[Items_Id] = Me.ADItemNumber.Column(0) ORDER BY [Components].[ComponentNumber]"
    Me.Refresh
End Sub

I am sure I am missing something to make it work.

thank you,

Was it helpful?

Solution

I was able to fix my own problem. See EDIT section in my question

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top