Results 1 to 12 of 12
  1. #1
    rui_parente is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    6

    Function Me.Refresh excluding a subform

    Good afternoon



    I have a DB and in one of the forms there is a subform.

    I need to use the function Me.Refresh to update a date.

    I don't want to, however, to update the subform that i have associated with this form.

    Is there any way (or code) that I can use to not update the subform? Or for example use the function Me.Refresh to update a single control of the form?

    I've tried the function Me.Requery and it didn't work.

    Thank you

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    How about

    Me.ControlName.Requery
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rui_parente is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    6
    Sorry. No good. Error "Message Method or Data Member not found".


  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Did you change the control name? And adjust to the full reference if it's on a form different than the code?

    Forms Refer to Form and Subform properties and controls
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Did you try just setting the control to the new value?

    me![ControlName] = NewDateValue

    However, if the control you are updating affects the data that is shown in the subform, then you probably can't change the date value without the subform being updated as well.

  6. #6
    rui_parente is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    6
    The Refresh part of the Code is as follows:

    Dim ano As String
    ano = right(Date, 2)
    Me.Nš_do_PA = num & "/L-EFLI/" & ano
    Me.[Data do PA] = Date
    Me.Refresh

  7. #7
    rui_parente is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    6
    pbaldy, i did that.

    But the problem subsists... When I use the code that contains the Me.Refresh part the data in the subform erases.

    The code is activated through a button in the main form and the control is also in the main form. The problem is the subform.

  8. #8
    rui_parente is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    6
    Hi John_G.

    Is it possible to do it simultaneously?

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Is it possible to do it simultaneously?
    I'm not sure what you mean by "simultaneously" - can you explain, please?

    What data (i.e. controls) do you use to link the subform to the main form?

  11. #11
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I think that the question
    Quote Originally Posted by John_G View Post

    ...What data (i.e. controls) do you use to link the subform to the main form...
    is important because your statement
    Quote Originally Posted by rui_parente View Post

    ...When I use the code that contains the Me.Refresh part the data in the subform erases...
    suggests that you're changing a value on the Main Form that is used to relate the Main Form/Subform Records...when it changes there is no longer a related Record in the Subform, hence the 'erasing' of data in the Subform.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  12. #12
    rui_parente is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    6
    Correct Missinglinq.

    I figured it out in the weekend.

    It has nothing to do with the Me.Refresh I was refering to.

    Thanks to you all, neverthless, for the help.

    Quote Originally Posted by Missinglinq View Post
    I think that the question


    is important because your statement


    suggests that you're changing a value on the Main Form that is used to relate the Main Form/Subform Records...when it changes there is no longer a related Record in the Subform, hence the 'erasing' of data in the Subform.

    Linq ;0)>

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

Similar Threads

  1. How To Refresh The SubForm?
    By Mahendra1000 in forum Access
    Replies: 11
    Last Post: 10-01-2013, 02:48 PM
  2. Subform refresh
    By Ruegen in forum Forms
    Replies: 13
    Last Post: 08-10-2013, 03:05 AM
  3. Need Subform to Refresh
    By lenm in forum Forms
    Replies: 7
    Last Post: 10-11-2012, 01:32 PM
  4. Replies: 15
    Last Post: 11-09-2010, 04:27 PM
  5. refresh subform
    By asmith in forum Forms
    Replies: 5
    Last Post: 09-27-2010, 10:58 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