Results 1 to 4 of 4

Thread: database filter procedure

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    canada
    Posts
    15

    Post

    Could you be more specific and give a bit more details, like examples

  2. #2
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232

    Post

    maybe you can code something like the following (i haven't tested this so there might be some mistakes in it, but just to give you an idea)

    Code:
    for i = 1 to 10
       if txtFields(i).Text <> "" then
          if sSQLWhere = "" then
             sSQLWhere = "WHERE " & txtFields(i).DataField & "= '" & txtFields(i).Text & "' "
          else
             sSQLWhere = sSQLWhere & "AND " & txtFields(i).DataField & "= '" & txtFields(i).Text & "' "
          end if
       end if
    next i
    
    sSQL = "SELECT * FROM table " & sSQLWhere

  3. #3
    New Member
    Join Date
    Jan 2000
    Location
    Sheffield
    Posts
    3

    Post

    my problem is that i have about 10 fields but i need to be able to search my database for any of the fields, i.e a filter thing so it looks at what data entered to search for, then runs the search procedure taking out relevant records. This is put into a temporary file which you can look at. I can do it on principal but not in code. Thanks for your time, help and all dat.
    DAVE

  4. #4
    Junior Member
    Join Date
    Nov 1999
    Location
    Muscatine, Iowa, USA
    Posts
    18

    Post

    Hi,
    I have done something similiar to what pardede suggests and it works but you have to add the logic to get out of the loop. What I did was a case statement. that checked the text boxes by priority to set the WHERE statement.
    Jim

Posting Permissions

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



Click Here to Expand Forum to Full Width