DB behavior is bizarre

TB11

Member
Local time
, 22:40
Joined
Jul 7, 2020
Messages
81
One of by DB's is doing the following: in a form or table, sometimes when I am adding records in a short text field, the cursor is not acting normal. If I change part of the text in the field, the cursor jumps around, and letters that I am not trying to delete get deleted or moved to a new place in the text string. Today, when I tried to replace a form, the DB crashed, and on DB re-load that form is not in the navigation pane. (I already checked and form is not hidden either.) I've compacted and repaired a lot, but odd behavior continues. Do I just rename the DB or copy everything from wonky DB to new DB?
 
You need to figure out why - usual reasons are form timer and sendkeys

This happens even when you are adding records directly into a Table manually? (something you shouldn't normally ever do, not that it's relevant here). That would be very strange, as no Automation can be attached to that other than data macros
 
Losing control of your mouse pointer usually means something else trying to take it over. This can happen if something else is trying to bring some other item into focus, which drags the mouse cursor around with it. As noted by CJ, timers and something doing a SendKeys behind the scenes could do it. But it could be something else not related to Access at all. It could be another task. For instance, if you have Outlook set up with special rules and mail comes in that would trigger those rules, that could do it. This behavior COULD be due to system notifications set to be too aggressive in trying to notify you.

The bit about replacing a form that causes a crash OFTEN (but not always) means that for some reason, you aren't fully in developer mode, i.e. something else thinks it is in run-time mode. So what else is going on behind this form? Answer that question, but don't limit your search for an answer to staying inside of Access itself.
 
@CJ_London I know I should not work direct in a table, but I slip into direct table data entry once in awhile.

This DB has been weird since day 1. To my knowledge I have no timers or special send keys, and I only use a few send keys in Access (select all, copy, paste and that's it).

Thank you, all for your suggestions. I certainly have a love-hate relationship with Access.
 
That would be very strange, as no Automation can be attached to that other than data macros
Not quite true - if you have a form timer or using send keys that can affect what the cursor does regardless of where it is currently located - even if the cursor is in a different app.

You try editing vba with a form timer running
 
Not quite true - if you have a form timer or using send keys that can affect what the cursor does regardless of where it is currently located - even if the cursor is in a different app.

You try editing vba with a form timer running
Good point, that is true of course - while it can't be 'attached' to the table editing action, it still could be operating from .. pretty much anywhere, actually, even outside Access.
 
Do I just rename the DB or copy everything from wonky DB to new DB?
Don't copy - open a new blank db and import objects one type at a time - tables, then queries etc.

Then compile your code, resolve any issues and finally compact/repair.
when I tried to replace a form
How? safest way is to import from, not export to or copy/paste

Generally better to split your app into BE and FE as a matter of course. Only exception might be if the app is of no consequence and doesn't matter if it is lost.
 
You can also try changing the font and see if that makes a difference. Some fonts don't seem to calculate their spacing correctly, and it's like the insertion point is not where you think it is. You type, and the characters are not inserted into the string where you expect.
 
To silence all timers, I use this code:

Sub silenceTimers()
Dim frm As Form
Dim ctl As Control

For Each frm In Forms
If frm.TimerInterval <> 0 Then
Debug.Print frm.name, frm.TimerInterval
frm.TimerInterval = 0
End If

For Each ctl In frm.Controls
If TypeOf ctl Is SubForm Then
If ctl.SourceObject <> "" Then
Set frm = ctl.Form
If frm.TimerInterval <> 0 Then
Debug.Print frm.name, frm.TimerInterval
frm.TimerInterval = 0
End If
End If
End If
Next ctl
Next frm
End Sub
 
To silence all timers, I use this code:
Riffing off your code, if you broke it out into subroutines, you could do it like this...
Code:
Sub SilenceTimers()
    Dim frm As Form
    For Each frm In Forms
        SilenceAll frm
    Next frm
End Sub

Private Sub SilenceAll(frm As Form)
    SilenceFormTimer frm
    SilenceSubformTimers GetSubforms(frm.Controls)
End Sub

Private Sub SilenceFormTimer(frm As Form)
    If frm.TimerInterval <> 0 Then
        Debug.Print frm.Name, frm.TimerInterval
        frm.TimerInterval = 0
    End If
End Sub

Private Sub SilenceSubformTimers(sfms As VBA.Collection)
    Dim sfm As SubForm
    For Each sfm In sfms
        If sfm.SourceObject <> "" Then SilenceAll sfm.Form
    Next
End Sub

Private Function GetSubforms(Controls As Controls) As VBA.Collection
    Dim ctl As Control
    Set GetSubforms = New VBA.Collection
    For Each ctl In Controls
        If TypeOf ctl Is SubForm Then GetSubforms.Add ctl
    Next
End Function
This approach is recursive. The SilenceSubformTimers() routine calls back to SilenceAll(), so it will navigate subforms of subforms, nested as deep as they may go.
 

Users who are viewing this thread

Back
Top Bottom