access hijacks desktop

  • Thread starter Thread starter Andy G
  • Start date Start date
A

Andy G

I have run across a few issues from my clients lately. It seems like one
form, when open will hijack the desktop when Access does not have focus.
I'll be on my browser and then Access will pop up on the screen like I
clicked the program on the task bar.



I have some code that runs behind one of these forms that
refreshes/requeries every minute to gather the new data in the system. That
is the only thing that I can think of on why this is occurring.



Any ideas?
 
Andy G said:
I have run across a few issues from my clients lately. It seems like
one form, when open will hijack the desktop when Access does not have
focus. I'll be on my browser and then Access will pop up on the
screen like I clicked the program on the task bar.

I have some code that runs behind one of these forms that
refreshes/requeries every minute to gather the new data in the
system. That is the only thing that I can think of on why this is
occurring.

Any ideas?

I assume you're using the Timer event to do this.

That does sound like a good suspect, but a test I just ran suggests that
merely requerying or refreshing the form in the Timer event doesn't make
the Access application grab the focus. What is the exact code that you
have in the Timer event?
 
Here is the exact code that runs on the timer event. Any direction/ideas
would help greatly.

Thanks!


Private Sub Form_Timer()
FillText
End Sub

Public Function FillText()
TestTodayRequery (the code is below)

Dim rst As ADODB.Recordset
Dim rstData As Variant
Dim InDs As Integer

Set rst = New ADODB.Recordset
rst.Open "qTestStations", CurrentProject.Connection, adOpenForwardOnly,
adLockReadOnly
'rst.Filter = "Team = '" & Forms!Global!Team & "' "
rstData = rst.GetRows
numRecs = UBound(rstData, 2) + 1

'fill the boxes
For InDs = 0 To numRecs - 1
If InDs < numBoxes Then
Me("LastName" & (InDs + 1)) = rstData(0, offset + InDs)
[Forms]![Global]("TeamNum" & InDs + 1) = rstData(0, offset +
InDs)
Me("Schedule" & InDs + 1).Visible = True
Me("LastName" & InDs + 1).Visible = True
'Me("Schedule" & InDs + 1).Requery
Me("LastName" & InDs + 1).Requery
Set Me("Schedule" & InDs + 1).Form.Recordset = SubFormPopulate(8
+ InDs + 1)
End If
Next InDs

For InDs = numRecs To numBoxes - 1
Me("LastName" & InDs + 1).Visible = False
Me("Schedule" & InDs + 1).Visible = False
Next InDs

ScrollButtonEnable (code is below)

rst.Close
End Function


Public Function TestTodayRequery()
Forms!TestAdmin!subAppt.SourceObject = "TestAdminAppts"
End Function


Private Sub ScrollButtonEnable()
'Disable buttons if the records are at their limit on either side
Dim Left, Right As Boolean
Left = (offset <> 0)
Right = ((offset + numBoxes) < numRecs)
'DoCmd.GoToControl "Schedule1"
btnTeamMembersLeft.Enabled = Left
btnTeamMembersRight.Enabled = Right
End Sub
 
Andy G said:
Here is the exact code that runs on the timer event. Any
direction/ideas would help greatly.

[code snipped]

That's a fair anount of code, but I don't see anything in that will
obviously grab the focus. This code could also cause other code to run,
too; for example, code in the Open, Load, and Current events of the
form "TestAdminAppts".

If I were you, I'd start commenting out lines in the various code
procedures involved, one at a time, to see if I could narrow down the
possibilities and ultimately identify the exact statement that is
causing the problem. I'd set the TimerInterval to something much
shorter, like maybe 10 seconds, to speed up the testing process. The
first thing to do is comment out the call to FillText in the Timer
event, just to verify that something in there is causing the problem.
 
Back
Top