Update Multiple Forms

G

Gee

I've got a form that is always open. It's only function is to send an email
when certain criteria are met. It has it's own query.
I've got other forms that also are also based on their own queries where
records are input and changed.
All the forms are based on the same table.
The problem is that when a record is input into the other forms, it doesn't
up date on the email form.
What can I do to make that form update when a new record is input in the
other forms?

Thank you in advance for any help you can give me.
 
D

Douglas J. Steele

Maybe. <g>

It depends, of course, where the code runs. I'd probably put it on the On
Got Focus event of the EmailForm, in which case MeRequery would be correct.
 
K

Klatuu

Good Morning, Doug. You are up early this morning.

If the form has any controls on it that can take the focus, the GotFocus
event will not work. The Activate Event will.

My guess is the OP's form is hidden since it's purpose is to send emails.
He didn't say how that happens, whether the user takes an action or he is
using the Timer event. If the user takes action, I would suggest the
Activate. If it is done in the Timer event, I would suggest putting it there.
 
D

Douglas J. Steele

Sorry: you're right, I meant Activate, not GotFocus.

You're probably right about the form being hidden, in which case your
suggestions make sense (although would you use Activate for a hidden form?).
Hopefully the OP will let us know.

Given you're a time zone behind me, who are you to say I'm up early? <g> I
normally get into the office by 05:45.
 
J

John W. Vinson

05:45 ?

I don't even make it the coffe pot until 6:00

And I get to my computer bright and early at 10...

The early bird gets the worm, but who wants worms!?
 
D

Douglas J. Steele

John W. Vinson said:
And I get to my computer bright and early at 10...

The early bird gets the worm, but who wants worms!?

My supervisor for my Master's degree was a jazz musician, so he was used to
late-night gigs.

As a concession to me, he would often schedule meetings for the crack of
noon.
 
K

Klatuu

Been there, Done that, Got the sweaty T shirt.

When I was playing keyboards it is impossible to practice in your room, so
when we played hotel gigs, my practice time was from when ever the night
ended until the breakfast crew came in.
 
G

Gee

Hello!
The form is not hidden, just shrunk.
It is run on a timer.
I tried Requery on a Got Focus already and it froze so it stopped running
through the calls and updating the counter.
This is my code...any ideas please?

Private Sub Form_Timer()
Dim currentTime As Date
currentTime = Format(Now(), "h:m:s")
Me.txtCurrentTime.Value = currentTime

If CallDate > 0 Then
NOC = DateDiff("s", TimeValue(CallDate), TimeValue(txtCurrentTime))
End If

If NOC = "400" Then
DoCmd.SendObject acSendReport, "NOCR", acFormatSNP, Me.Text39, , , "NOC
AGING", Me.CallNo, False
End If

If NOC = "2700" Then
DoCmd.SendObject acSendReport, "NOCR", acFormatSNP, Me.Text41, , , "NOC
AGING", Me.CallNo, False
End If

If CallDate > 0 Then
DoCmd.GoToRecord , , acNext
Else: DoCmd.GoToRecord , , acFirst
End If

End Sub
 
G

Gee

Actually, that is all working just fine...the email fires when it reaches a
counter of 400 and again when it reaches a counter of 2700...that's all
working great. I even added the AddIn to bypass the security warning so it
sends without any user interaction which is what I need.

My problem is how to update the form when it's open...when a new record is
put into the database table from a different form, this one needs to update
and isn't.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top