I have an application that I'm adding another form to and in the process, I stumbled across code that worked at one time and now does not. Grrrr...
I'm selecting usernames from a table and using them (or trying to use them) to populate a ComboBox(the style is set to 2 Dropdown List). Every time I run the code, the reordcount is -1
If I take the same query and run it against the actual table, the records are there.
What am I doing wrong? I can pull data from the database in other areas of the application.
I even tried breaking out the code into a standalone with just the dropdown and still the recordcount is -1
I'm posting my code. I'm connecting to an Oracle database and the connection is already open.
thanks in advance for help
Public Sub Set_Prod_Control_Values()
Dim i As Integer
Dim strSQL As String
Dim strCat As String
strCat = "PC"
Dim rsPC As ADODB.Recordset
Set rsPC = New ADODB.Recordset
strSQL = "Select * from USERS WHERE Category = '~'"
strSQL = Replace(strSQL, "~", strCat)
rsPC.Open strSQL, gDC, adOpenForwardOnly, adLockReadOnly, adCmdText
If Not rsPC.EOF Then
Me.cboProdControl.AddItem "Select Name"
For i = 1 To rsPC.RecordCount-1
Me.cboProdControl.AddItem (rsPC.Fields!User_Name), i
Set rsPC = Nothing