traveller4
Programmer
I am hoping to get somwe help on this one.
I am trying to populate a combo Box with two field values.
MinistryID
MinistryName
Ministry name is showing but the ministry ID is passed on as a parameter to a stored procedure in a SQL server 2000 database
The problem I have come across is that the ministry ID is varchar with alpha numeric characters
(example: 3CI4CCDA43L120)
Here is my code sample:
'Set a reference to the ADO recordset object
Set g_objRS = New ADODB.Recordset
'Open the recordset object
g_objRS.Open "USP_select_Ministries_SLA_Tacking", g_objConn, adOpenForwardOnly, adLockReadOnly, adCmdStoredProc
'Loop through the recordset and load the Ministry combo box
Do While Not g_objRS.EOF
'Add the Ministry Name
cboMinistryID.AddItem g_objRS!MinistryName
'Add the Ministry ID
cboMinistryID.ItemData(cboMinistryID.NewIndex) = g_objRS!MinistryID
'Move ot the next record
g_objRS.MoveNext
Loop
'Close and dereference the recordest object
g_objRS.Close
Set g_objRS = Nothing
This method has worked in the past as all my ID numbers are integers.
Is there a special way to handle varchar data in combo boxes indexes. Any help would be greatly appreciated
--Thanks in advance
I am trying to populate a combo Box with two field values.
MinistryID
MinistryName
Ministry name is showing but the ministry ID is passed on as a parameter to a stored procedure in a SQL server 2000 database
The problem I have come across is that the ministry ID is varchar with alpha numeric characters
(example: 3CI4CCDA43L120)
Here is my code sample:
'Set a reference to the ADO recordset object
Set g_objRS = New ADODB.Recordset
'Open the recordset object
g_objRS.Open "USP_select_Ministries_SLA_Tacking", g_objConn, adOpenForwardOnly, adLockReadOnly, adCmdStoredProc
'Loop through the recordset and load the Ministry combo box
Do While Not g_objRS.EOF
'Add the Ministry Name
cboMinistryID.AddItem g_objRS!MinistryName
'Add the Ministry ID
cboMinistryID.ItemData(cboMinistryID.NewIndex) = g_objRS!MinistryID
'Move ot the next record
g_objRS.MoveNext
Loop
'Close and dereference the recordest object
g_objRS.Close
Set g_objRS = Nothing
This method has worked in the past as all my ID numbers are integers.
Is there a special way to handle varchar data in combo boxes indexes. Any help would be greatly appreciated
--Thanks in advance