Bring "zeros" from the DB of a String sql-vba field

0

I searched through all the sites and could not find a solution.

I have a project in VBA that brings data from SQL sql. The field I need to bring is a varchar type, so the variable in my project is of the string type. If I execute the query in managment it throws me: "01661" and in my project it is displayed as "1661". I need zero. Tips?

this is the query in the VBA project:

select TOP 1 CodProdAsoc from soft.tkit where CodProd = 'K0119CM'

CStr(rs.Fields.item(0))
    
asked by Sergio O Ayala Yañez 25.10.2018 в 19:21
source

0 answers