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

Thank you David Fenton... but one more little thing.

P: n/a
All,

I posted this earlier yesterday and thanks to David, 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; it
says "You can't goto specified record")

==============================*=================== =====
With Me.RecordsetClone
.FindFirst "[Date1]<=#" & Now() & "# AND [Date2]>#" & Now() & "#"
If .NoMatch Then
MsgBox "No records matched your criteria."
Else
If Me.Dirty Then Me.Dirty = False
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 goto anther record 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
pe******@yahoo.com wrote in
news:11**********************@g49g2000cwa.googlegr oups.com:
All,

I posted this earlier yesterday and thanks to David, 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; it says "You can't goto specified record")

==============================*================== =
====
With Me.RecordsetClone
.FindFirst "[Date1]<=#" & Now() & "# AND [Date2]>#" & Now() &
"#"
If .NoMatch Then
MsgBox "No records matched your criteria."
Else
If Me.Dirty Then Me.Dirty = False
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 goto anther record 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#


I've answered this question several times now. This is the last
time.

The code should be in the OnCurrent event of the parent form. It
will fire each time you move to a new record in the parent form, and
move to the records of the child form that match the dates in your
criteria.

However, your code is wrong for that. The OnCurrent of the parent
form should use a With block that refers to the child form's
RecordsetClone:

With Me!SubForm.Form.RecordsetClone
[the rest of the code remains unchanged, except]
Me!SubForm.Form.Bookmark = .Bookmark
End With

Again, if this doesn't answer your question or solve your problem,
then it's clearly a problem with your explanation -- so far as I am
able to understand what you're trying to accomplish, this is the
answer. But if I've not understood, it's probably not going to work.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.