Results 1 to 3 of 3
  1. #1
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501

    Add or condition to loop

    I have this code



    Code:
    Do Until ts.AtEndOfStream
            strText = ts.ReadLine
            'Only import lines starting with 1
            If Left(strText, 1) = 1 Then
                ts2.Write (strText & vbCrLf)
            End If
        Loop
    Basically it reads a file and only keeps lines that begin with a number 1. I would like to change it to accept 1 and 2

    Would this do it?

    If Left(strText, 1) = 1 OR Left(strText, 1) =2 Then

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Have you tried it? I'd say yes.


    Sent from my iPhone using Tapatalk

  3. #3
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501
    yes, it worked. I was a little hesitant to try without some confirmation because it is a production database.

    It did the trick though.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 03-07-2017, 02:49 PM
  2. Replies: 12
    Last Post: 06-05-2015, 04:27 PM
  3. Replies: 13
    Last Post: 08-20-2014, 09:17 AM
  4. Replies: 17
    Last Post: 04-07-2014, 07:48 PM
  5. Replies: 3
    Last Post: 03-10-2013, 07:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums