Form Recordset Event Trapping

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Access 2000 application that I'm building. I need subforms to show or not show based upon the value(s) of controls on the main application form. I've got it working when I load the main form; however, I need to be able to trap the underlying recordset's move events (MoveFirst, MovePrevious, MoveNext, MoveLast) so I can have the subforms showing or not showing correctly when I scroll through the records. How do I access the events from the Access IDE? This is a trivial thing to do in ADO and ADO.NET; but, I'm having trouble doing it in Access. Thanks in advance for any guidance/help rendered.
 
If you are writing the application entirely in VBA (that is, you are not
using Current events of the form, or it is totally detached from any
data sources), I think you want to write your own wrapper class that
will include your recordset with its methods and post events that you
are interested in at the time you want.
This in my eyes defeats the purpose of using Access though because you
might as well use the features it makes available. In this case, it is
the Current event of the main form which triggers every time the user
mover to another record in the form.

Pavel
 
Pavel

I tried using the Current event; however, it seems to fire BEFORE the record move is complete. I need an event that will fire AFTER the record move is complete. Any ideas? Thanks for the help.
 
Greg,

Take a look at the event sequencing in Access forms (it is laid out in
VBA Help in details) - you can use an overwhelming number of events such
as BeforeUpdate, AfterUpdate, Dirty, GotFocus, LostFocus etc. not just
for the form itself but for each individual control. Once you are
familiar with the sequence the events issue I am sure you will find a
few that will fire when you need it.
I recall that Current is fired when you enter a record. AfterUpdate is
fired when you leave an updated record, but please read the exact MS
wording yourself - don't take my word for it.

Pavel
 
Back
Top