Results 1 to 4 of 4
  1. #1
    TasCat09 is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    6

    Issues with form refresh

    Good morning

    I was hoping someone could help me understand why my VBA code cannot refresh a userform.



    I am using Access 2019 and have a simple database that includes a continuous form. Part of the form is a field to display a field from a table. The field is either set to no or yes and is displaying as expected. I am using this method as a workaround for allowing a user to select different records because I was not able to get checkbox controls to work on the continuous form.

    I have a command button in the detail section of the continuous form that toggles the field between no and yes whenever the user clicks it. The field for a specific record changes from no to yes (or vice versa) correctly each time the user clicks the button but I cannot get the form to refresh (and show the new value) without manually clicking the refresh button or by selecting refresh all. I have tried a couple of things so far without success including the most obvious (i.e. adding '[Forms]![FormName].Refresh' in the code for the command button click event).

    I have even tried putting 'me.refresh' in form events and then either triggering those events or calling that sub from within the command button click event but nothing (other than manually pressing the refresh button) seems to work.

    I don't think it is relevant as the controls are all working fine and the fields update when I manually hit refresh but I have got the userform set as a snapshot recordset type as I essentially want the form to be read only.

    Despite searching for an answer to this problem, I am completely stumped and would appreciate any help at all.

  2. #2
    TasCat09 is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    6
    My bad, syntax error. FYI, correct syntax was DoCmd.Requery (FormName) . Requery instead of Refresh but works great.

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,537
    Could you not just requery the checkbox.

    Me.CheckboxName.Requery
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  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,537
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 8
    Last Post: 08-30-2015, 02:54 PM
  2. Replies: 4
    Last Post: 10-09-2014, 07:09 PM
  3. Access 2010 Refresh VS Refresh ALL
    By Snwboarder1982 in forum Access
    Replies: 1
    Last Post: 09-09-2011, 04:07 PM
  4. Refresh Form
    By tpcervelo in forum Forms
    Replies: 7
    Last Post: 02-07-2011, 08:03 AM
  5. refresh a form
    By RedGoneWILD in forum Forms
    Replies: 18
    Last Post: 09-03-2010, 08:31 AM

Tags for this Thread

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