473,320 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
1 1266
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Tony Toews | last post by:
Folks David Fenton does a fine job in helping folks in this newsgroup. I have learned from his postings and have enjoyed our discussions here. He belongs in this newsgroup more than many. ...
3
by: Tess | last post by:
Okay. You asked for it. Here it is. Everything below the cutmark is pure, grade A, unadulterated David Fenton. Or see for yourself at: ...
33
by: Anthony England | last post by:
I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on...
10
by: Anthony England | last post by:
(sorry for the likely repost, but it is still not showing on my news server and after that much typing, I don't want to lose it) I am considering general error handling routines and have...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.