Results 1 to 6 of 6
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371

    Reference From A Subform

    Hi Guy's Can I reference from a subform ?



    ie: I have a subform called InvoicesAdd on a Form called frmInvoices

    If i am correct, when i try and reference from the subform, effectively it has to be opened yet it is displayed as visible is true ?

    but when i reference something, the reference can't find it

    So if i have a button on frmInvoices and i want to add and change my criteria and the RecordSource of frmInvoicesAdd then requery it

    Forms!frmInvoices!InvoicesAdd.RecordSource = "SELECT......

    It can't find it!!

    Thank you very much

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Perhaps:
    Forms!frmInvoices!InvoicesAdd.Form.RecordSource = "SELECT......

    See:
    http://allenbrowne.com/casu-04.html
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371
    Thanks Bob, this works great, i think was using ! instead of .Form

    Thank you

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by DMT Dave View Post
    Thanks Bob, this works great, i think was using ! instead of .Form

    Thank you
    Actually, I think you were missing the "Form."
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371
    I am having trouble referencing again on a subform

    myCust = Forms!frmInvoices!frmInvoicesAdd!cboCustomer
    invNo = Forms!frmInvoices!frmInvoicesAdd.txtInvoiceNumber

    Code:
    Dim invNo As Integer, myCust As String
    
    
    myCust = Forms!frmInvoices!frmInvoicesAdd!cboCustomer
    invNo = Forms!frmInvoices!frmInvoicesAdd!txtInvoiceNumber
    Object a Property Doesn't Support This Method

    Runtime Error 438

  6. #6
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,371
    Sorry, Rookie error, had the field named incorrectly !!!!!!!!!!!

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

Similar Threads

  1. Subform control reference
    By SunTop in forum Forms
    Replies: 3
    Last Post: 04-26-2017, 03:50 AM
  2. reference objects on subform
    By gammaman in forum Modules
    Replies: 2
    Last Post: 08-27-2015, 07:31 AM
  3. Replies: 5
    Last Post: 08-09-2012, 12:49 PM
  4. Query reference to a subform
    By hawkins in forum Forms
    Replies: 3
    Last Post: 08-05-2011, 10:49 AM
  5. Creating a reference to the subform.
    By evander in forum Forms
    Replies: 2
    Last Post: 05-26-2010, 09:39 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