By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 663 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

Help w/ On Open Vs On_Open Vs On_Current

P: n/a
All,

I posted this earlier yesterday and here is more situation.
Thanks to David, by the way, for his codes here. It kinds of work, but
not always.

I have a MainForm with a subform. When I place the following
code in the Subform's On_Open, it only works for 1x (at open) when the
mainform is open with the subform. When I goto another record in the
main form, it quits working (i.e. not the most recent dated record is
on the top, however, I can browse the records within the subforms)

================================================== ====
With Me.RecordsetClone
.FindFirst "[Date1]<=#" & Now() & "# AND [Date2]>#" & Now() & "#"
If .NoMatch Then
MsgBox "No records matched your criteria."
Else
Me.Bookmark = .Bookmark
End If
End With
================================================== =====

If I place the above codes in On_Current event, it works when I
go from records to records to display the current calender schedule in
the mainform, but I can not browse the records within the subform!

What else event can I use? (I have tried them all, pretty much)
Or can the above code be modified to fit my situation? Please help.

P.S.: the mainform and the subform are linked by a Record#

Sincerely,
Perry

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You didn't say whether you used the On Current event in the main Form or the
On Current event in the Form embedded in the Subform Control. The latter
would fire every time you moved from one Record to another in the Subform.
The former would fire every time you move from one Record to another in the
main Form.

Larry Linson
Microsoft Access MVP

<pe******@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
All,

I posted this earlier yesterday and here is more situation.
Thanks to David, by the way, for his codes here. It kinds of work, but
not always.

I have a MainForm with a subform. When I place the following
code in the Subform's On_Open, it only works for 1x (at open) when the
mainform is open with the subform. When I goto another record in the
main form, it quits working (i.e. not the most recent dated record is
on the top, however, I can browse the records within the subforms)

================================================== ====
With Me.RecordsetClone
.FindFirst "[Date1]<=#" & Now() & "# AND [Date2]>#" & Now() & "#"
If .NoMatch Then
MsgBox "No records matched your criteria."
Else
Me.Bookmark = .Bookmark
End If
End With
================================================== =====

If I place the above codes in On_Current event, it works when I
go from records to records to display the current calender schedule in
the mainform, but I can not browse the records within the subform!

What else event can I use? (I have tried them all, pretty much)
Or can the above code be modified to fit my situation? Please help.

P.S.: the mainform and the subform are linked by a Record#

Sincerely,
Perry

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.