T
Tony
OK, I have Outlook 2000 running on an internal network with Exchange
Server 2000.
Now I designed a form with combo boxes that have multiple columns. To
fill this Multiple column combo box I am using a stored procedure from
the SQL server.
Here is some similar data that is being returned to fill the combo
box.
KUNNR Name1 KTOKD
---------- --------- ----
0002002176 Company 1 0001
0002011007 Company 2 0002
0002008643 Company 3 0003
0002011850 Company 4 0001
0002002114 Company 5 0003
0003001177 Company 6 0002
My problem lies here: PayerCustArray(i, 1) = Rs.fields("KUNNR")
What I can't seem to do is to trim the zeros off the front of the
KUNNR column. Any suggestion would be great.
Thanks
Code Example:
Sub FillPayerList()
set CN = CreateObject("ADODB.Connection")
set RS = Application.CreateObject("ADODB.Recordset")
Dim PayerCustArray()
CN.ConnectionTimeout = 10
CN.Open "Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=Catalog1;Data Source=DatabaseName"
' *************************************************************************
' * Description: Execute the query and fill the SoldToNum combo box
' * with the customers Name and Account Number.
' *************************************************************************
strsql = "exec sqlStoredProcedure"
RS.Open strsql, CN, adOpenKeyset
PayerNum.Clear
i=0
do until RS.eof
i = i + 1
RS.movenext
loop
ReDim PayerCustArray(i,2)
rs.movefirst
i = 0
do until RS.eof
PayerCustArray(i, 1) = Rs.fields("KUNNR")
PayerCustArray(i, 0) = Rs.fields("Name1")
PayerCustArray(i, 2) = Rs.fields("KTOKD")
RS.movenext
i = i + 1
loop
' replace(ltrim(replace(i,'0',' ')), ' ', '0')
' PayerNum = Right("0000000000" & PayerNum,10)
' PayerNum = PayerNum.PadLeft(10)
PayerNum.List = PayerCustArray
CN.Close
Set CN = Nothing
Set RS = Nothing
End Sub
Server 2000.
Now I designed a form with combo boxes that have multiple columns. To
fill this Multiple column combo box I am using a stored procedure from
the SQL server.
Here is some similar data that is being returned to fill the combo
box.
KUNNR Name1 KTOKD
---------- --------- ----
0002002176 Company 1 0001
0002011007 Company 2 0002
0002008643 Company 3 0003
0002011850 Company 4 0001
0002002114 Company 5 0003
0003001177 Company 6 0002
My problem lies here: PayerCustArray(i, 1) = Rs.fields("KUNNR")
What I can't seem to do is to trim the zeros off the front of the
KUNNR column. Any suggestion would be great.
Thanks
Code Example:
Sub FillPayerList()
set CN = CreateObject("ADODB.Connection")
set RS = Application.CreateObject("ADODB.Recordset")
Dim PayerCustArray()
CN.ConnectionTimeout = 10
CN.Open "Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=Catalog1;Data Source=DatabaseName"
' *************************************************************************
' * Description: Execute the query and fill the SoldToNum combo box
' * with the customers Name and Account Number.
' *************************************************************************
strsql = "exec sqlStoredProcedure"
RS.Open strsql, CN, adOpenKeyset
PayerNum.Clear
i=0
do until RS.eof
i = i + 1
RS.movenext
loop
ReDim PayerCustArray(i,2)
rs.movefirst
i = 0
do until RS.eof
PayerCustArray(i, 1) = Rs.fields("KUNNR")
PayerCustArray(i, 0) = Rs.fields("Name1")
PayerCustArray(i, 2) = Rs.fields("KTOKD")
RS.movenext
i = i + 1
loop
' replace(ltrim(replace(i,'0',' ')), ' ', '0')
' PayerNum = Right("0000000000" & PayerNum,10)
' PayerNum = PayerNum.PadLeft(10)
PayerNum.List = PayerCustArray
CN.Close
Set CN = Nothing
Set RS = Nothing
End Sub