Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Feb 2004
    Posts
    90

    Question Unanswered: Refreshing Data Records on a Subform

    Hi.

    I have a function on a database where the user can choose to add some "standard" records to another record. These standard records (44 in total) are viewed in a subform (continuous) on the parent record form (single). The “standard” records are added fine, but they don't show up until the form is closed and then re-opened again. I've tried the "refresh" command to no avail.

    So I'm looking for a way so that either, the "standard" records are automatically shown when added (ideal), or as a work around, the form is closed and the re-opened straight away, and is opened automatically to the same record as before.

    Any help would be greatly appreciated.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Me.SubformControlName.Requery

  3. #3
    Join Date
    Feb 2004
    Posts
    90
    Thanks for responding , but I'm not sure where to put the code. I should mention that the button used to create the "standard" records is also in a subform (single) on the parent record's form.

  4. #4
    Join Date
    Feb 2004
    Posts
    90
    It works if I put another button on the parent record and put the code in there, however I wish the code to go into the button that creates the "standard" records. This button is contained in another subform on the parent. How do I code it so that it relates to another subform? (i.e. not "me").

    Thanks again.
    Last edited by Goldy; 02-16-04 at 15:22.

  5. #5
    Join Date
    Feb 2004
    Posts
    199
    Forms!anotherformname!anothersubformcontrollname.F orm.Requery
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  6. #6
    Join Date
    Feb 2004
    Posts
    90
    Cheers.

    But I've tried:

    Forms![1c_Client_Enquiry_Areas_1]![1d_Client_Enquiry_Costings].Form.Requery

    "1c_Client_Enquiry_Areas_1" is the parent form and "1d_Client_Enquiry_Costings" the other subform that needs requering.

    But I get:

    cannot find the form "1c_Client_Enquiry_Areas_1"

  7. #7
    Join Date
    Feb 2004
    Posts
    199
    Ether
    1) there is mistake in stirng "1c_Client_Enquiry_Areas_1"
    or
    2) form "1c_Client_Enquiry_Areas_1" isn't opened

    is the "1d_Client_Enquiry_Costings" subform's name or subform's containing controll name, it should be controll name, not subform name as form name
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  8. #8
    Join Date
    Feb 2004
    Posts
    90
    Ok I spelt the parent form wrong. But now I get:

    Can't find the field "1d_Client_Enqui
    ry_Costings".


    ???

  9. #9
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by Goldy
    Cheers.

    But I've tried:

    Forms![1c_Client_Enquiry_Areas_1]![1d_Client_Enquiry_Costings].Form.Requery

    "1c_Client_Enquiry_Areas_1" is the parent form and "1d_Client_Enquiry_Costings" the other subform that needs requering.

    But I get:

    cannot find the form "1c_Client_Enquiry_Areas_1"
    Here's a great link on the syntax of different ways to reference controls/properties...

    http://www.mvps.org/access/forms/frm0031.htm

    If the error is saying that it can't find the form, one of two things is going wrong...
    1) you've misspelled the name of the form... or
    2) [1c_Client_Enquiry_Areas_1] is not open... The Forms Collection only contains forms that are currently open...

  10. #10
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by Goldy
    Ok I spelt the parent form wrong. But now I get:

    Can't find the field "1d_Client_Enqui
    ry_Costings".


    ???
    You want the Subform CONTROL name... Not the Subform name itself... Make sure you have that right...

  11. #11
    Join Date
    Feb 2004
    Posts
    90
    But why is it saying that is can't find the "field"??

    All things are right now. And I'm referencing the CONTROLS, and not the subform's names.

  12. #12
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by Goldy
    But why is it saying that is can't find the "field"??

    All things are right now. And I'm referencing the CONTROLS, and not the subform's names.
    On your form, what is the name of the subform/report control? Use THAT name for your Requery action ...

    Ex: Me![Purchase Request Items].Requery


    P.S. I use this myself ...

  13. #13
    Join Date
    Feb 2004
    Posts
    90
    It's:

    Me.[1d_Client_Enquiry_Costings].Requery

    That works fine.

  14. #14
    Join Date
    Feb 2004
    Posts
    90
    Opps misread.

    I need reference from a subform to the parent and then to another subform on that parent.

  15. #15
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by Goldy
    But why is it saying that is can't find the "field"??

    All things are right now. And I'm referencing the CONTROLS, and not the subform's names.
    Before I answer... let me make sure I understand what you've got here.... 1 main/parent form called "1c_Client_Enquiry_Areas_1" and you have 2 separate subforms on the main form... Correct?

    You have a button on let's say subform 1... and you want to update subform 2's data from subform 1?

    If you are on subform 2... and you want to reference subform 1... I would use ... Me.Parent!ControlName.Requery

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •