Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8342571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:48:49+00:00 2026-06-09T05:48:49+00:00

There’s a csv file like so, I can read it easily enough with the

  • 0

There’s a csv file like so, I can read it easily enough with the code below. But as you can see there are multiple name1, group1, status1, name2, group2, etc columns in the csv. Each user will have a different number of columns. I was wondering if there is a way to use wild cards where I’m calling objRecordset.Fields.Item("Group1") something like ("Group%") or if I can auto increment the number until no records are found

UserName,Domain,Site,MCO,Name1,Group1,Status1,Name2,Group2,Status2,Name3,Group3,Status3
Paolina,AA,Athens,Greece,Adobe Acrobat Pro,ACROBAT009,Live,,,,,,
George,AA,Athens,Greece,SpotFire 2.20,SPOTFIRE220,Live,,,,,,

option explicit

Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001

Dim strPathtoTextFile, objConnection, objRecordSet, objNetwork
Dim wshshell, Username

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

Set objNetwork = CreateObject("WScript.Network")
userName = objNetwork.UserName

strPathtoTextFile = "C:\Hunter\vbs\" 'must have a trailing \

objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=" & strPathtoTextFile & ";" & _
          "Extended Properties=""text;HDR=YES;FMT=Delimited"""

objRecordset.Open "SELECT * FROM Users.txt where [user name] like '" & UserName & "'", _
          objConnection, adOpenStatic, adLockOptimistic, adCmdText
Do Until objRecordset.EOF
    Wscript.Echo "Name: " & objRecordset.Fields.Item("User Name")
    Wscript.Echo "Group: " & objRecordset.Fields.Item("Group1")
    Wscript.echo "Status:" & objRecordset.Fields.Item("Status1")
    objRecordSet.MoveNext
Loop
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:48:50+00:00Added an answer on June 9, 2026 at 5:48 am

    Your example suggests that the maximum group number is the last field, so perhaps:

    objRecordset.Open "SELECT * FROM Users.txt where [user name] like '" _
          & UserName & "'", _
          objConnection, adOpenStatic, adLockOptimistic, adCmdText
    MaxNum = _
          Replace(objRecordset.Fields(objRecordset.Fields.Count-1).Name,"Status","")
    Do Until objRecordset.EOF
        Wscript.Echo "Name: " & objRecordset.Fields.Item("User Name")
        For i=1 to MaxNum
           Wscript.Echo "Group: " & objRecordset.Fields.Item("Group" & i)
           Wscript.echo "Status:" & objRecordset.Fields.Item("Status" & i)
        Next
        objRecordSet.MoveNext
    Loop
    

    I have not tested, but the general idea should hold.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a text file with 1,000,000 lines of code floating around and Ctrl+F
There have been multiple questions regarding this topic but I have never really settled
There's a lot of reading on self referencing problems, but I can't seem to
There are things like f.call(...) f.apply(...) But then there's this (1, alert)('Zomg what is
There is a perforce bundle for TextMate but I can't get to auto-check out
There's a Rails 3.2.3 web application which doesn't use any database. But in spite
There are nice SO question and answers about this issue, but these options didn't
There are several shading languages available today like GLSL, HLSL, CG, which one to
There are many string matching algorithms can be used to find a pattern (string)
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.