Results 1 to 8 of 8
  1. #1
    BasilM is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2012
    Posts
    8

    SQL search results in a datasheet

    Hi everyone,


    I have a form that contain two field (A and B) ( the values of the fields will be populated automaticlly in the form load based on other cratiria)

    those two field are a key together

    I want once I open the form, a subform - datasheet to be populated in that form

    can I do this by SQL statement where I can say .. Select all records where ATableFeild =A and BTavleField=B

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    You have a form/subform arrangement where subform records are child records related to main form record? Set the Master/Child links properties of the subform container control. This will synchronize display of associated records.
    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.

  3. #3
    BasilM is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2012
    Posts
    8
    I tried to do this
    it gives me msg:

    can't build links to unbound form!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Then what do you mean by 'have a subform'? Why do you have a subform on a main form if they don't have a relationship?
    Review http://office.microsoft.com/en-us/ac...010098674.aspx

    Want to provide db for analysis? Follow instructions at bottom of my post.
    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
    BasilM is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2012
    Posts
    8
    thanks a lot for your reply
    I wanted these lines ( I found them in the internet) :
    strSql = "SELECT * FROM Controls WHERE AssetID='" & AssetID '"
    Debug.Print strSql

    Me.sbfOrderDetails.Form.RecordSource = strSql



    many many thanks for your support

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Well, that looks like good example code but not really much info to work with. What happens when you run it? Are those your control and field names? Is AssetID a number or text value?
    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.

  7. #7
    BasilM is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2012
    Posts
    8
    yes these are field names
    AssetID is a text value

    when I run it it works fine
    only one small issue
    I can't select certine fields in the subform
    meaning : when I select A,B,C
    it shows me the coulms but empty !

    do you have any idea?
    I mean can I invisible some coulmns?!

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Too much unknown. Provide db for analysis. Follow instructions at bottom of my post.
    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.

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

Similar Threads

  1. Replies: 5
    Last Post: 01-03-2013, 01:38 PM
  2. Search - If no results
    By adams.bria in forum Programming
    Replies: 5
    Last Post: 04-03-2012, 09:59 AM
  3. how to highlight search keywords in results form?
    By Absolute_Beginner in forum Forms
    Replies: 2
    Last Post: 08-22-2011, 04:52 AM
  4. ComboBox Search - No Results
    By cvansickle in forum Forms
    Replies: 5
    Last Post: 03-27-2011, 03:37 PM
  5. Replies: 1
    Last Post: 10-24-2010, 04:01 PM

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