Click next until the End of File

S

Shiller

Experts,

I'm trying to automate a process. I want my sub form to automatically
click next until the end of file then triggers the main form to move
to the next record, and the loop continues until there's no more
record. Right now I have to manually click next, and I'm not too
familiar with recordset and EOF.

Please help.
 
R

ruralguy via AccessMonster.com

You have told us what you want to do. How about telling us what you are
trying to achieve and there may be another way to get there. That is unless
you are trying to make a movie.
 
S

Shiller

You have told us what you want to do. How about telling us what you are
trying to achieve and there may be another way to get there. That is unless
you are trying to make a movie.




--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted viahttp://www.accessmonster.com

the recordcount of the subform is stored into a the table link to my
main form. So every time I click on next on the subform if the
recordcount has been updated it will automatically update the table.
That's why I'm figuring out a way to click next until the end of the
record so i don't have to manually click next.
 
R

ruralguy via AccessMonster.com

Are you simply trying to determine the quantity of records in the SubForm
that qualify for the LinkChild/MasterFields for each record in the MainForm?
You have told us what you want to do. How about telling us what you are
trying to achieve and there may be another way to get there. That is unless
[quoted text clipped - 15 lines]
Message posted viahttp://www.accessmonster.com

the recordcount of the subform is stored into a the table link to my
main form. So every time I click on next on the subform if the
recordcount has been updated it will automatically update the table.
That's why I'm figuring out a way to click next until the end of the
record so i don't have to manually click next.
 
S

Shiller

Are you simply trying to determine the quantity of records in the SubForm
that qualify for the LinkChild/MasterFields for each record in the MainForm?
You have told us what you want to do. How about telling us what you are
trying to achieve and there may be another way to get there. That is unless
[quoted text clipped - 15 lines]
Message posted viahttp://www.accessmonster.com
the recordcount of the subform is stored into a the table link to my
main form. So every time I click on next on the subform if the
recordcount has been updated it will automatically update the table.
That's why I'm figuring out a way to click next until the end of the
record so i don't have to manually click next.

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted viahttp://www.accessmonster.com

I already got that part to work. here's what I'm trying to do: I want
my sub form to automatically
click next until the end of file then triggers the main form to move
to the next record, and the loop continues until there's no more
record.
 
R

ruralguy via AccessMonster.com

As I said earlier in this thread: Are you making a video or something?
Are you simply trying to determine the quantity of records in the SubForm
that qualify for the LinkChild/MasterFields for each record in the MainForm?
[quoted text clipped - 18 lines]
Message posted viahttp://www.accessmonster.com

I already got that part to work. here's what I'm trying to do: I want
my sub form to automatically
click next until the end of file then triggers the main form to move
to the next record, and the loop continues until there's no more
record.
 
S

Shiller

As I said earlier in this thread: Are you making a video or something?
Are you simply trying to determine the quantity of records in the SubForm
that qualify for the LinkChild/MasterFields for each record in the MainForm?
[quoted text clipped - 18 lines]
Message posted viahttp://www.accessmonster.com
I already got that part to work. here's what I'm trying to do: I want
my sub form to automatically
click next until the end of file then triggers the main form to move
to the next record, and the loop continues until there's no more
record.

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200710/1

lol... I really wish I was making a video but unfortunately I'm not.
I'm experimenting with this piece of code that does exactly what I'm
looking for, I place it in the on Close event of both my subform and
my main form, and it runs until the end of file of the subform then
the form before closing:
**********************************************
Private Sub Form_Close()

Dim rst As Recordset

Set rst = Me.RecordsetClone
rst.MoveLast
rst.MoveFirst
Do While Not rst.EOF
Me.Bookmark = rst.Bookmark

rst.MoveNext
Loop
Set rst = Nothing

End Sub
*********************************************

The only problem now I'm getting the following error message: "Run-
time error '2001', you canceled the previous operation"...

Can you please help,

Thanks,
 
R

ruralguy via AccessMonster.com

Are you aware of the order of the events? When opening a form, the SubForm
opens 1st. When closing, the sequence is reversed so the MainForm closes
before the SubForm.
As I said earlier in this thread: Are you making a video or something?
[quoted text clipped - 17 lines]

lol... I really wish I was making a video but unfortunately I'm not.
I'm experimenting with this piece of code that does exactly what I'm
looking for, I place it in the on Close event of both my subform and
my main form, and it runs until the end of file of the subform then
the form before closing:
**********************************************
Private Sub Form_Close()

Dim rst As Recordset

Set rst = Me.RecordsetClone
rst.MoveLast
rst.MoveFirst
Do While Not rst.EOF
Me.Bookmark = rst.Bookmark

rst.MoveNext
Loop
Set rst = Nothing

End Sub
*********************************************

The only problem now I'm getting the following error message: "Run-
time error '2001', you canceled the previous operation"...

Can you please help,

Thanks,
 
S

Shiller

Are you aware of the order of the events? When opening a form, the SubForm
opens 1st. When closing, the sequence is reversed so the MainForm closes
before the SubForm.


[quoted text clipped - 17 lines]
lol... I really wish I was making a video but unfortunately I'm not.
I'm experimenting with this piece of code that does exactly what I'm
looking for, I place it in the on Close event of both my subform and
my main form, and it runs until the end of file of the subform then
the form before closing:
**********************************************
Private Sub Form_Close()
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.MoveLast
rst.MoveFirst
Do While Not rst.EOF
Me.Bookmark = rst.Bookmark
rst.MoveNext
Loop
Set rst = Nothing
End Sub
*********************************************
The only problem now I'm getting the following error message: "Run-
time error '2001', you canceled the previous operation"...
Can you please help,

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted viahttp://www.accessmonster.com

Allan,

I wasn't aware of the order of events, thanks to your input now I have
greater insight of what's happening when opening or closing a Main
form with subforms. I found out from another thread that an After
Update or a Before Update events may cause that problem. I got rid of
a useless After Update event in my main form and now it works.
 
R

ruralguy via AccessMonster.com

That's great! Thanks for posting back with your success.
Are you aware of the order of the events? When opening a form, the SubForm
opens 1st. When closing, the sequence is reversed so the MainForm closes
[quoted text clipped - 43 lines]
Message posted viahttp://www.accessmonster.com

Allan,

I wasn't aware of the order of events, thanks to your input now I have
greater insight of what's happening when opening or closing a Main
form with subforms. I found out from another thread that an After
Update or a Before Update events may cause that problem. I got rid of
a useless After Update event in my main form and now it works.
 

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