dcsimg
Results 1 to 3 of 3

Thread: How to filter out rows in a certain column by number of characters?

  1. #1

    Thread Starter
    Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, R. Macedonia
    Posts
    49

    How to filter out rows in a certain column by number of characters?

    For safety I colored the rows in my picture, but you can call the columns whatever you like:

    Name:  Length_Access200_Filter.PNG
Views: 215
Size:  6.6 KB

    It happens that we import data into the Access table from Excel and some of the columns which should be formatted with 4 character places, contain only data in 3 places.

    Without scrolling to the bottom of the table, how can I filter out rows in a certain column which contain less or more characters then the needed number of characters?

    In this case rows with 3 chars, and it should be with 4.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    23,651

    Re: How to filter out rows in a certain column by number of characters?

    probably the easiest is to read the worksheet as a recorset, with an sql query
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Java (JSP) Hell!
    Posts
    5,278

    Re: How to filter out rows in a certain column by number of characters?

    Code:
    SELECT *
      FROM tablename
     WHERE LEN(tablename.fieldname) <> 4

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width