I have a callback function that correctly fills a combobox (A) with two-column data on load. I have a second combobox (B) that acts as a filterchoice for the first. When the combobox B is updated, I have a AfterUpdate event to requery the combobox A. However, the process doe snot change a thing in combobox A. Watching the code run through I see the function correctly create the new array needed, but the function never goes to the acLBGetValue section to change the data.
Code:
Option Compare Database Option Explicit Dim chkitm As Variant Dim ProvID As Integer Dim rs_Provider As New ADODB.Recordset Dim rs_Measure_Class As New ADODB.Recordset Dim rs_Measure As New ADODB.Recordset Dim rs_OPPE As New ADODB.Recordset Dim FilterCrit As String Dim DWConn As New ADODB.Connection Dim strCxn As String Dim StrSQL As String Dim StrSQLMeasClass As String Dim StrSQLMeas As String Dim StrSQLOPPE As String Dim AddSw As Boolean Dim editsw As Boolean Dim Entries As Integer Dim PrvChk As Variant Dim MID As Integer Dim PID As Integer Dim Provider_Assigned_List As String Public Function DW_Connect() strCxn = "Provider='SQLOLEDB';Data Source=vhaomadmg;Database=NWIPerfMon;Integrated Security=SSPI;" Set DWConn = New ADODB.Connection DWConn.Open strCxn End Function Function Fill_Assigned_Provider_List(fld As Control, ID As Variant, row As Variant, col As Variant, code As Variant) As Variant Static Provider_Assigned_List() As Variant Static ProvCount As Integer Const TWIPS = 1440 Select Case code Case acLBInitialize ' Initialize. DW_Connect rs_Provider.CursorLocation = adUseServer If Not IsNull(Me.cmb_Svc_Section) Then StrSQL = "Select * from dim.Provider where InactivationDate is null and ServiceSection like '" & Me.cmb_Svc_Section.Column(0) & "';" Else StrSQL = "Select * from dim.Provider where InactivationDate is null and ServiceSection is not null;" End If rs_Provider.Open StrSQL, DWConn, adOpenKeyset, adLockOptimistic, adCmdText ReDim Preserve Provider_Assigned_List(rs_Provider.RecordCount, 1) As Variant Fill_Assigned_Provider_List = True rs_Provider.MoveLast rs_Provider.MoveFirst ProvCount = 0 For chkitm = 0 To rs_Provider.RecordCount - 1 Provider_Assigned_List(ProvCount, 0) = rs_Provider.Fields("ProviderSID") Provider_Assigned_List(ProvCount, 1) = rs_Provider.Fields("StaffName") ProvCount = ProvCount + 1 rs_Provider.MoveNext Next chkitm Case acLBOpen ' Open. Fill_Assigned_Provider_List = Timer Case acLBGetFormat Fill_Assigned_Provider_List = -1 Case acLBGetRowCount ' Get number of rows. Fill_Assigned_Provider_List = ProvCount Case acLBGetColumnCount ' Get number of columns. Fill_Assigned_Provider_List = 2 Case acLBGetColumnWidth ' Column width. Select Case col Case 0: Fill_Assigned_Provider_List = 0 Case 1: Fill_Assigned_Provider_List = 3 * TWIPS End Select Case acLBGetValue ' Get data. Fill_Assigned_Provider_List = Provider_Assigned_List(row, col) Case acLBEnd DWConn.Close rs_Provider.Close Erase Provider_Assigned_List End Select End Function Private Sub cmb_Svc_Section_AfterUpdate() Me.cmb_Provider.Requery End Sub
Comment