maximize access from task bar

Ade F

Avid Listener
Local time
Today, 23:21
Joined
Jun 12, 2003
Messages
97
I'm trying to create this Dcount procedure to maximize access from the task bar should a new note become present in the job history table. It looks to me that if the ID value has increased then this should in theory bring up the page. The timer event is set to thirty seconds. With this code working it would help to gain the users attention in regards to important notes / messages.

It appears that after the alloted time the Dcount hidden field increments by 1 but the form does not maximize? . Having initially tested / placed the refresh command directly after the

Public Sub Form_Timer()

line the screen refreshes fine, it just seems that the If statement is not being executed after the initial txtHiddenCount is defined. If anyone should have ideas or a workaround solution then this would be much appreciated.

Public Sub Form_Timer()
Me.txtHiddenCount = DCount("[ID]", "job history")
If DCount("[ID]", "job history") > Me.txtHiddenCount Then
DoCmd.RunCommand acCmdAppMaximize
Me.txtHiddenCount = DCount("[ID]", "job history")
End If
End Sub
 
I quess on Form_Timer() you need:
txtHiddenCount.Requery
 
New code still not working

I tried the requery and it's still doesn't maximize. I have slightly modified the code below but I still cannot see why access isn't maximizing.


Public Sub Form_Timer()

AutoRefresh

Me.txtHiddenCount = DCount("[Product ID]", "Products")
Me.Suppliers = DCount("[Supplier ID]", "Suppliers")
Me.Orders = DCount("[OrderID]", "Orders")
Me.Job_Notes = DCount("[ID]", "job history")
Me.Projects = DCount("[Job Number ID]", "Job_Details")
Me.Clients = DCount("[Customer ID]", "Customers")

If DCount("[ID]", "job history") > Me.Job_Notes Then
DoCmd.RunCommand acCmdAppMaximize

Me.Job_Notes = DCount("[ID]", "job history")

Job_Notes.Requery
End If
End Sub
 
Last edited:
Just in case did you set TimerInterval=1000 on form property?
 
50000

no the timer interval is set to 50000 for thirty seconds.

Should this matter? The statement and fields are updated upon the timer execution.
 
Hi again
I do not understand when ID value has increased (when you type it or timer increase itself)?
 
Dcount

The ID is an autonumber value in the job history table. As soon as somebody creates a new note then the number increases thus dcount detecting this and adding 1 to Me.Job_Notes. As far as I could see it the only way to maximize access from the taskbar upon a new note being written was approcahing it in this way. Do you have any other ideas?
 
Ade, the reason it is not working is because you are setting the value before you are testing for it and therefore the comparison test will always be false. The code should be as follows.

Code:
Public Sub Form_Timer() 
If DCount("[ID]", "job history") > Me.txtHiddenCount Then 
     DoCmd.RunCommand acCmdAppMaximize 
     Me.txtHiddenCount = DCount("[ID]", "job history") 
End If 
End Sub

Set the initial value of txtHiddenCount in the Form_Open() Event.
 
Finally

It worked like a charm. Thanks Fizzio. This should come in very handy for a LAN coms tool.

Regards

Adrian
 

Users who are viewing this thread

Back
Top Bottom