preserve 0

spinkung

Registered User.
Local time
Today, 21:22
Joined
Dec 4, 2006
Messages
267
Hi All,

I am trying to lookup up a cell value from excel to a recordset in my db. Some of the cells in excel have values like 002I, 003T which are text fields but some are 002, 003.

My rs field is a text field from a table. When the lookup happens vba sees 002, 003 as 2, 3 so the value is not matched in my rs. how do i preserve the zero's so the match is found??

tried this...
Code:
If CStr(Trim(xlSht.Range(colRef_service & iRow).Value)) = rs1!service_ID Then
...but it doesn;t work.


Anyone???

Thanks, Spin.
 
if the numbers are always preceeding by two 0's, you can concat them into the excel value. as such:
Code:
"00" & cstr(excel retrieval code)
 

Users who are viewing this thread

Back
Top Bottom