Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2006
    Posts
    111

    Unanswered: Find a string inside queries

    Is there a quick way to search through all my queries and look for a string? I can either find/replace myself if there's an easy way, or else I have to let my customer test and when he hits errors replace them then.

    Thanks.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Try the query collection ... You can use the InStr function or the Replace function ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Jul 2006
    Posts
    111
    What I meant was the same way in Modules you can do a Find or a Find/Replace. I think what you're saying would work, but I'd have to write code and execute it somehow. I don't want it to be a permanent part of the application, just a one-shot deal while I'm developing the application.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    In that case then no - you cannot.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Dude... 7 lines of code is too much work?

    Code:
      Dim qdf As QueryDef, strSql As String, strSearch As String
      strSearch = "yoursearchtext"
      For Each qdf In CurrentDb.QueryDefs
        strSql = qdf.SQL
        If InStr(1, strSql, strSearch) > 0 Then
          MsgBox "String found in " & qdf.Name
        End If
      Next
    Inspiration Through Fermentation

  6. #6
    Join Date
    Jul 2006
    Posts
    111
    No, that is not too much work, but I would not known how to code it, so thank you.

    And that's actually dudette.

  7. #7
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    There I go making assumptions again...

    Sorry, dudette!
    Inspiration Through Fermentation

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Eek! A dudette!

    Watch your language, boys!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  9. #9
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by RedNeckGeek
    Dude... 7 lines of code
    Sounds like a challenge....

    I got it down to 3 (option explicit off):
    Code:
      For Each qdf In CurrentDb.QueryDefs
      
        If InStr(1, qdf.SQL, "yoursearchtext") > 0 Then MsgBox "String found in " & qdf.Name
        
      Next
    M Mock - iterating collections is a very useful tool in your... er... toolbox - studying RNG's code will serve you well in the future
    Testimonial:
    pootle flump
    ur codings are working excelent.

  10. #10
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Quote Originally Posted by pootle flump
    studying RNG's code will serve you well in the future
    heh... And I left it at 7 for exactly that reason!
    Inspiration Through Fermentation

Posting Permissions

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