Form + Sub Form Question

  • Thread starter Thread starter The Boondock Saint
  • Start date Start date
T

The Boondock Saint

Howdy All,
Ive got a form which has a timer in it.... and which updates the record
every 10 secs (this is so the most recent time is saved into the record)

Id like to have another form... which uses variables from the first form....
such as the current time and a gameid value....

Ive done this with subform but when im in the 2nd form and i go to type into
a text field ... it saves it pretty much as soon as i put in 1 letter into
the text box....

Any ideas on how this can be resolved?
 
Howdy All,
Ive got a form which has a timer in it.... and which updates the record
every 10 secs (this is so the most recent time is saved into the record)

Id like to have another form... which uses variables from the first form....
such as the current time and a gameid value....

Ive done this with subform but when im in the 2nd form and i go to type into
a text field ... it saves it pretty much as soon as i put in 1 letter into
the text box....

Any ideas on how this can be resolved?

By not saving every ten seconds. A Subform is under the control of the
mainform; when you save the record in the mainform, it must perforce
save the record in the subform (all the subforms in fact). You may
want to set the mainform's TimerInterval to 0 in the subform's
GotFocus event (and back to 10000 in its LostFocus).

If the second form needs the current time, can't it just get it from
the Now() function, rather than from the form???

John W. Vinson[MVP]
 
Thanks John
I should have pointed out.... the time isnt the current time.... but the
time passed from when i start the timer on the main form..... so its only
showing min's and sec's

Here is the code...

Private Sub Form_Timer()
Static intCount As Integer
SecondCount = SecondCount + 1
Me!lblclock.Caption = Format(SecondCount \ 60, "00") & ":" &
Format(SecondCount Mod 60, "00")
time = lblclock.Caption
DoCmd.RepaintObject
intCount = intCount + 1
If intCount = 10 Then
DoCmd.RunCommand acCmdSaveRecord
intCount = 0
End If
End Sub

Do you think maybe i could do something similar... with the intCount ...
that way.. the time would continue to carry on..... but the record wont save
until intCount = 10....
 
Do you think maybe i could do something similar... with the intCount ...
that way.. the time would continue to carry on..... but the record wont save
until intCount = 10....

If I understand the problem correctly, you'll still have trouble with
the subform. Saving the mainform record will requery the subform, no
way I know of around it!

You may want to use a Popup form (which will be independent of the
calling form) rather than using a subform. A bit more code to keep
them in synch but that may be your best bet.

John W. Vinson[MVP]
 

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

Back
Top