Page 3 of 3 FirstFirst 123
Results 31 to 37 of 37
  1. #31
    JayGee1969 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    17

    No, I haven't solved it yet, just not had chance to look at it since my last post on Friday. Please bear with me as I am juggling different tasks, of which this is only one. I do appreciate your continued help, thank you for your patience.

  2. #32
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Good morning -

    You were a lot closer to getting it to work than you thought.

    In your Customer Order form, In the After Update (I moved it from Before Update, but that's not critical) event of CustomerID, fix the code to this:

    Me.[Orders SubForm].Form!ProductCode.RowSource = "Select ProductID from products where CustomerID = " & Me!CustomerID
    Me.[Orders SubForm].Form!ProductCode.Requery

    Add that was needed was to change the Recordsource to RowSource, and to add the square braces around [Orders Subform] (required whenever there is a space in an object name).

    Add the same two lines to the On Open event of the Customer Order form, so that the product list is correct when the form is first opened.

    Add the same code in the same places in the Customer Order by order ID form.

    I strongly suggest you do not allow the CustomerID to be changed in the Customer Order by order ID form, otherwise you could find yourself in a real mess, because the data in the OrderDetails table would be wrong.

    There are other things that need fixing (e.g. Customer Orders subform1 has an error) , but the above should get you moving again.

    Cheers!

    John

  3. #33
    JayGee1969 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    17
    Thanks John - tried that but got a Microsoft Visual Basic Run-time error '2465': Microsoft Access can't find the field '|1' referred to in your expression.

    As I have renamed my forms now to frmCustOrd1 and frmCustOrd1Sub do I take it I don't need the square brackets any more?

  4. #34
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    There is no harm in using the Square Brackets but you must use them when you have spaces in the Names. You should not be using spaces anyway.

  5. #35
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    If you have renamed the subforms, and used those names in the code I used, that is the error. In a line like this:

    Me.[Orders SubForm].Form!ProductCode.RowSource = "Select ProductID from products where CustomerID = " & Me!CustomerID ,

    [Orders Subform] is not the name of the subform - it is the name of the control on the main form that contains the subform. When you rename the subform, you need to change the Source Object property of that control to the new name of the subform. But as long as you don't change change the name of the control itself, the code can be left as it was.

    I am assuming that the product list combo box on the subform is still called ProductCode.

    John

  6. #36
    JayGee1969 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    17
    John

    Thank you so much - I could kiss you xxx. That has solved the problem and I really appreciate your patience with me and getting me sorted.

    Many, many, many thanks, and thanks also to Rainlover for trying to put me on the right path.

  7. #37
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Thank you for the kind words - much appreciated. We're glad we are able to help.

    All the best as you continue with Access.

    John (and others)

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Subform to show records of Listbox
    By gbmarlysis in forum Forms
    Replies: 5
    Last Post: 02-27-2012, 04:03 PM
  2. Subform wont show in 2007
    By Jake in forum Access
    Replies: 1
    Last Post: 07-15-2011, 02:48 PM
  3. Show selected records in subform
    By Papilion in forum Forms
    Replies: 8
    Last Post: 06-18-2011, 07:41 AM
  4. Subform will not show data
    By Brian62 in forum Forms
    Replies: 2
    Last Post: 02-19-2010, 10:43 AM
  5. Replies: 4
    Last Post: 10-29-2008, 11:53 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