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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding ASCII values in a STRING variable

Status
Not open for further replies.
Feb 12, 2003
45
US
Hi all,
I'm pulling some data from the active user list table using the openschema function to enumerate the active user list. For example I'm trying to take each entry for 'login_name' and drop it to a text file. The problem is this: I'm trying to create a modified string that includes data from the openschema method with some other data - but when I write the line it adds line-feeds for each reference from the openschema function - THEN - when I do a len(.fields("login_name") it reports a length of 32 even though the visible result is only 'Admin'... there must be some additional characters appended to the end of the string - but my string manipulation skills in VBA are pretty thin. Can anyone help me decipher this? Code snip follows at the bottom.
Thanks,
Chris

set rst1 = cnn1.openschema(adschemaproviderspecific, , _
"{947bb102-5d43-11d1-bdbf-00c04fb92675}")
with rst1
do until .EOF
str3 = .Fields("login_name")
msgbox str3
rem note: will show 'admin'
msgbox len(Str3)
rem note: will show 32
str1 = date & ":" & .fields("login_name") & _
environ("USERNAME")
print #1, str1

.movenext
loop
end with


NOTE: results of the print command will be as follows:

03/04/2004 : Admin
chris

I'm trying to get the result to look like this:

03/04/2003 : Admin chris
 
Thanks for the reply LostInCode... it pointed me to the right direction... I figured out the results of the openschema is fixed-width... Actually, I ended up using the rst.getrows method. Your idea pointed me to the array process - and it helped me learn a few things as well as realize the total length of the row was 70 characters... there are 4 elements in the array (32 char, 32 char, 4, and 2 lengths respectively)... Which made me realize I could probably use the mid function to pick out the good data. I then ran the rtrim on the first element and it showed the length at 6 (for the admin username instead of 32 as it was showing previously) - then I ran the mid with the len(str)-1 to clear out whatever annoying special character is at the end of the string ... is there a way to find out what that 6th character is? (not sure if it's a cr, crlf, or what...??)
Thanks for your suggestion!
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top