Results 1 to 5 of 5
  1. #1
    manicminer is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2012
    Posts
    8

    Query based on actual record

    Hello everybody, I have a specific problem. I have a table with names (first and last) and other data. And I need a query which will show only the rows containing specific first names (e.g.all rows with names "John"). The value (in this case the first name), should be selected from the currently selected record (the user chooses a record using a form an then generates a query which will contain all the records containing the first name from his currently selected record.


    I never made a db in access before, so maybe my question is trivial. But if anybody knows how to solve this will help me immensely.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    I do not follow your request but to find all records in MyTable with FirstName = "John"

    Select *
    From MyTable
    WHERE
    FirstName = "John";

  3. #3
    manicminer is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2012
    Posts
    8
    OK, but I would need something like FirstName=firstname_from_currently_opened_record. Not a predefined "john"

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    The record is open on a form then the query can refer to control on form as input parameter, like:

    SELECT * FROM MyTable WHERE FirstName = Forms!formname!textboxname
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    manicminer is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2012
    Posts
    8
    Thanks a lot June7!!!!!! As a complete beginner, it took me some time to figure it out (practically no knowledge of SQL), but it works. Thanks again ! :-)

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

Similar Threads

  1. Query column info rather than actual value
    By nicnicman in forum Access
    Replies: 5
    Last Post: 12-15-2011, 09:21 PM
  2. Budget vs Actual
    By chaos in forum Access
    Replies: 1
    Last Post: 05-04-2011, 08:25 AM
  3. Replies: 5
    Last Post: 10-15-2010, 01:19 PM
  4. Replies: 2
    Last Post: 10-13-2010, 07:09 AM
  5. Query based on current record in form
    By bhsvendbo in forum Queries
    Replies: 1
    Last Post: 06-01-2010, 11:20 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