Access 2010 query parameters

Page 1 of 2 12 LastLast

  1. Posts : 152
    Windows 7 Pro 64-bit
       #1

    Access 2010 query parameters


    Hello,

    How do I include a portion of a field in a query parameter?

    For example, if one record's data in the field I'm querying is, say, "RPMX-1011" and another record's data is, say, "CO-0852", how do I tell the query I want all records that have "PM" appearing somewhere in the field?
      My Computer


  2. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #2

    select * from tablename where fieldname like "*PM*"
      My Computer


  3. Posts : 150
    Windows 7 Professional x64
       #3

    Kaktussoft said:
    select * from tablename where fieldname like "*PM*"
    i agree
      My Computer


  4. Posts : 152
    Windows 7 Pro 64-bit
    Thread Starter
       #4

    I'm sorry - it's clear to you two, but not to me. When you say "select * from tablename", does that mean I drag the * into my query? And what does "where fieldname like "*PM*" mean? Do I type "like "*PM*"" somewhere? I'm not getting the results I need.
      My Computer


  5. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #5

    You're making a query using fields drag and drop? Then make the query as complete as you can. Can you make a parameter query? for example can you make a query that displays the birthday and name but only of the persons with name "Johnson"? I don't know your skills so don't know who to explain
      My Computer


  6. Posts : 152
    Windows 7 Pro 64-bit
    Thread Starter
       #6

    Well, the query already exists (I've been using it for some time even tho it doesn't give me fully accurate results), so I opened it and changed to Design view so I can edit it. From there, I dragged the * from the available fields in the table I'm using into the query. Yes, I believe I could do a query for all people named Johnson with a certain birthdate.
      My Computer


  7. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #7

    Make the query as good as possible. After that change to sql view. Post sql statement here please.
      My Computer


  8. Posts : 152
    Windows 7 Pro 64-bit
    Thread Starter
       #8

    SELECT [Business Licenses].[Lic#], [Business Licenses].BusinessName, [Business Licenses].FName, [Business Licenses].LName, [Business Licenses].MailAddr, [Business Licenses].City, [Business Licenses].State, [Business Licenses].Zip, [Business Licenses].BsPh
    FROM [Business Licenses]
    WHERE ((([Business Licenses].[Lic#]) Like "*PM*") AND (([Business Licenses].TypeOfBs)="property management"));
      My Computer


  9. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #9

    your query is right!
    It displays all fields listed after select. But only for those records where TypeOfBs="property management" and Lic# like "*PM*"

    what's the problem????
      My Computer


  10. Posts : 152
    Windows 7 Pro 64-bit
    Thread Starter
       #10

    The problem is there are some licenses that have "PM" as part of their license number that are not being included in the query results. Perhaps it's because there is also other text in the "property management" field?
    Last edited by CosmicJest; 09 Nov 2011 at 12:00. Reason: addl info
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:09.
Find Us