jum ahead to next record that a specific field changes

T

Ted

I have a table where field X changes with every record and field Y changes
every so many records (varying number of records). How do I get my form
based on this table to go to next/previous record where Y is different?
Thanks!
 
K

Klatuu

When Y is different than what?

If you mean when it changes from a previous record, you can use the form's
Current event to evaluate whether the value of field Y is different from the
value of the field Y in the previous record.

Private Sub Form_Current()
Static blnFirstY as Boolean
Dim varOldY As Variant

if blnFirstY Then
varOldY = Me.txtY
ElseIf Is varOldY <> Me.txtY Then
varOldY = Me.txtY
DoCmd.GoToRecord acDataForm, Me.Name, acNext
End If
 

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