Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    junction is offline Novice
    Windows Vista Access 2003
    Join Date
    Jan 2011
    Posts
    13

    Query to Form

    I can't believe I've forgotten how to do this!

    Basically, I have a form which is used to enter data (this also contains a subform but that's irrelevant!). I have also used the same design which opens when a query is run.

    The thing is, I want to open exactly the same form when another query is run (to keep the format, text boxes etc the same) but my minds gone blank!



    HELP!!!!!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It is just a matter of changing the RecordSource of the form.

  3. #3
    junction is offline Novice
    Windows Vista Access 2003
    Join Date
    Jan 2011
    Posts
    13
    Thanks, I'm getting there!

    I've now changed the RecordSource in the form but when I run the query (which is just a date filter) I'm getting 3 records, which is the same amount of records in the sub form.

    EG.

    Main table shows OrderNumber (which is an autonumber) with other fields of DateReady, DateReqd, BookingRef.

    The sub form shows Customer, GoodsType, StkCode, and Qty.

    So, there can be several Customers for one order number.

    Therefore, OrderNumber 1101210 has 3 Customers, DateReady = 21-Dec-10.

    When 21-Dec-10 is entered in the query this brings up 3 x OrderNumbers, should only be 1.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You know that Forms run queries, not the other way around, right?

  5. #5
    junction is offline Novice
    Windows Vista Access 2003
    Join Date
    Jan 2011
    Posts
    13
    Yes, I'm aware of that, I have written the query and everything works ok.

    When I open the Form I enter the appropriate date (in this case 21-Dec-10) which should bring up 1 record of OrderNumber 1101210 with 3 customers in the subform.

    Somehow this brings up 3 records of OrderNumber 1101210 with 3 customers, in other words it's duplicated by amount of customers in subform.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you using a Form/SubForm arrangement? Have you seen this: http://allenbrowne.com/ser-36.html

  7. #7
    junction is offline Novice
    Windows Vista Access 2003
    Join Date
    Jan 2011
    Posts
    13
    Yes. There is a Form and a SubForm.

    The relationship is OrderNum in tblPage1 (main form) and OrderNum2 in tblPage2 (subform).

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    To what do you have the SubForm LinkChild/MasterFields properties set?

  9. #9
    junction is offline Novice
    Windows Vista Access 2003
    Join Date
    Jan 2011
    Posts
    13
    Link Child Fields = OrderNum2
    Link Master Fields = OrderNum
    Enabled = Yes

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Just an aside but it is easier to understand years later if the fields have the same name. Do you have your NavButtons turned on on the MainForm? What happens when you just move from record to record on the MainForm? Are the SubForm records limited?

  11. #11
    junction is offline Novice
    Windows Vista Access 2003
    Join Date
    Jan 2011
    Posts
    13
    The NavButtons are turned on on the MainForm.

    After the query is run the MainForm says Record 1 of 3, the same as the SubForm.

    When I click right for the next record it is the same as the previous record.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Something is not right. Can you post your db so we can look at it?

  13. #13
    Join Date
    Feb 2010
    Location
    London, UK
    Posts
    21
    It sounds like you do not have the correct keys in your query used to link the subform back to the main.

  14. #14
    junction is offline Novice
    Windows Vista Access 2003
    Join Date
    Jan 2011
    Posts
    13
    The only forms you need to view are:

    frmQuery1
    frmQuery2 (which is the one in question)

    The Queries are:

    tblPage1 Query for frmQuery1
    qryFromToDateReady for frmQuery2

    The rest of the database needs tidying up so ignore everything else.

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I do not see a SubForm on your frmQuery2 form.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query to only show a value in a form from a query
    By cwwaicw311 in forum Queries
    Replies: 28
    Last Post: 03-27-2010, 02:31 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