A
Al Westerlund
I have an application that probation agents use to see who
is waiting in the waiting room to report. The
receptionists enter the reporting probationers name using
a form called "report" entering the agents caseload number
and the name of the offender on the report. This goes
into a table named "report". On the agents desktop, they
open up their form called AgentReportScreen by entering
their agent number and then the form is filtered on that
number. The following code is on that form.
Private Sub Form_Load()
Me.TimerInterval = 60000
End Sub
Private Sub Form_Open(Cancel As Integer)
Dim Message, Title As String
Message = "Enter your caseload number."
Title = "Set Filter for Agent Report Screen."
AgentNumber = InputBox(Message, Title)
Me.Filter = "[AgentNum] = '" & AgentNumber & "'"
Me.FilterOn = True
Me.OrderByOn = True
Me.OrderBy = "TimeReported DESC"
End Sub
Private Sub Form_Timer()
Me.Requery
Forms!AgentReportScreen![Name].SetFocus
End Sub
I changed the sort order so that the most recent person
reporting shows up on top of the screen so the agent does
not have to scroll down toward the end of the day to see
who has reported. I also needed to refresh the screen
every 60 seconds so that the filtered form picks up new
entries. The agent keeps the form open all day. I put the
SetFocus code in because some of the fields were going
blank (specifically the name field which is a concatenated
string with last + firs name) and that solved the problem.
The real problem I have is that at times, the requery does
not seem to pick up the latest entries the receptionists
put in the table and people are sitting in the waiting
room as the agent does not know they are there. Am I
using the wrong code to refresh the filtered form and
also, why was the name field going blank? Thanks in
advance.
Al Westerlund
is waiting in the waiting room to report. The
receptionists enter the reporting probationers name using
a form called "report" entering the agents caseload number
and the name of the offender on the report. This goes
into a table named "report". On the agents desktop, they
open up their form called AgentReportScreen by entering
their agent number and then the form is filtered on that
number. The following code is on that form.
Private Sub Form_Load()
Me.TimerInterval = 60000
End Sub
Private Sub Form_Open(Cancel As Integer)
Dim Message, Title As String
Message = "Enter your caseload number."
Title = "Set Filter for Agent Report Screen."
AgentNumber = InputBox(Message, Title)
Me.Filter = "[AgentNum] = '" & AgentNumber & "'"
Me.FilterOn = True
Me.OrderByOn = True
Me.OrderBy = "TimeReported DESC"
End Sub
Private Sub Form_Timer()
Me.Requery
Forms!AgentReportScreen![Name].SetFocus
End Sub
I changed the sort order so that the most recent person
reporting shows up on top of the screen so the agent does
not have to scroll down toward the end of the day to see
who has reported. I also needed to refresh the screen
every 60 seconds so that the filtered form picks up new
entries. The agent keeps the form open all day. I put the
SetFocus code in because some of the fields were going
blank (specifically the name field which is a concatenated
string with last + firs name) and that solved the problem.
The real problem I have is that at times, the requery does
not seem to pick up the latest entries the receptionists
put in the table and people are sitting in the waiting
room as the agent does not know they are there. Am I
using the wrong code to refresh the filtered form and
also, why was the name field going blank? Thanks in
advance.
Al Westerlund