Solved Form reload error ole and activex

Jomat

Member
Local time
Today, 10:11
Joined
Mar 22, 2023
Messages
69
Edited.
I already created a timer on the form to auto reload and took the reload button away. But is still curious why the error occurred.

Hi all.
I hope someone can shed some light on an issue that i have. I have a main form that have a query sub form to show some recent checked in data inputs. I have a button that closes the form and reopens it. This is to refresh the form data. I am not using the requery. I am using a macro. Everything works fine.
And then...
A patient actually did this by accident. The problem is: If i reload the form using the button to close and reopen the form, oh let's say continuelessly clicking the button 30 times or so I get the access error onload error about the ole server and activex. After the error appears, it randomly appears very frequently regardless if the user is just clicking the reload button once or twice.
The error goes away if you exit the database and restart it.
I was wondering if there is a way to prevent this from happening since the form is locked from exiting out of with a username and password. The form is used as a self sign in for patients who visits the dental office and it is an inconvenience if someone clicks the reload button continuelessly and causes the error for other patients when they arrive and want to sign in.
Using access 2019. Stand alone accdb file. Shared on network share drive. Opened in full screen mode. No tool bars, no navigation of windows explorer. Kind of like a kiosk setup.
Thanks.
 
Last edited:
you do not need to Close and Open the same form just to get new/refreshed
records.
on the click of the "reload" button just Requery the underlying recordset of the subform:
Code:
Private ReloadBtn_Click()
Me!TheNameOfTheSubform.Form.Recordset.Requery
End Sub

also to prevent users clicking the button, continuously, you can Disable it once clicked.
but in order to Disable it, you must SetFocus on another control (or Textbox) first.
you can add a dummy textbox (txtDummy) to your main form and set it's
Height and Width property to 0 (and remove its associated Label).
Code:
Private ReloadBtn_Click()
'Shift the focus to the dummy textbox
Me.txtDummy.Setfocus
'disable this button
Me.ReloadBtn.Enabled = False
Me!TheNameOfTheSubform.Form.Recordset.Requery
'Re-enable the button
Me.ReloadBtn.Enabled = True
End Sub
 
Last edited:
Thank you. I will use that along with the timer. I for some reason cannot recreate the error. It might be after a few compact and repair, it just didn't happen again. Clicking on the button 30 times or so continuelessly didn't produce the error again.
 
but in order to Disable it, you must SetFocus on another control (or Textbox) first.
Just for information:
At least with Microsoft Access 2016 (just tested again) you can disable the command button directly without having to move the focus first.
 
Just for information:
At least with Microsoft Access 2016 (just tested again) you can disable the command button directly without having to move the focus first.
Yes you’ve been able to do that since A2010 or thereabouts. You can also lock a control without moving focus. However you can’t hide a control without shifting focus unless you disable then hide it.
 
Or disable, then enable, then hide the control (just in case your intention is to have it enabled when you make it visible later on).
Or disable, hide and re-enable 😏

Anyway, I wrote an article about this 'feature' some time ago:
 

Users who are viewing this thread

Back
Top Bottom