Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert a colon into a DTS ActiveX Script looping recordset result

Status
Not open for further replies.

panini

MIS
Jun 1, 2001
136
GB
Hi,

I have some code:

Do while Not rs.EOF
strLine=chr(34)
for each x in rs.Fields
strLine= strLine & chr(34) & x.value & chr(34)
next
MyFile.writeline strLine
rs.MoveNext

that is looping through and writing the fields from a recordset into a .csv file that is then emailed to clients for a direct import into their system - my problem is that i have two time fields that come out as 4 digits i.e. 0800 or 1600 - I need to send it as 08:00 or 16:00.

They are the 11 and 16th fields that come back in each line, so i'm thinking i need to identify that field and split it into adding chr(58) which is a colon.

Many Thanks,
 
got it guys...

for each x in rs.Fields
if x.name = 'YourField' then
strLine= strLine & chr(34) & left( x.value ,2 ) + ':' + mid(x.vlaue,3,2) & chr(34)
else
strLine= strLine & chr(34) & x.value & chr(34)
end if
next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top