Count and insert unique values - Can this code be optimized?

前端 未结 3 1567
渐次进展
渐次进展 2021-01-26 18:09

I needed to generate an output from my Access database that was unavailable using standard functions. I did extensive searching, but when I found example code - it ultimately f

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-26 18:25

    I'm not quite sure what you're trying to achieve with that convoluted function of yours. Do you want to print the position in the alphabet for each letter you read from your database? That could be easily achieved with something like this:

    filename = "D:\Temp\_test.txt"
    
    Set rst = CurrentDb.OpenRecordset(QryName, dbOpenDynaset)
    
    Set f= CreateObject("Scripting.FileSystemObject").OpenTextFile(filename, 8, True)
    Do Until rst.EOF
      v = rst.Fields(fldName).Value
      f.WriteLine v & ", " & (Asc(v) - 96)
      rst.MoveNext
    Loop
    f.Close
    

提交回复
热议问题