Knowing when user changes form view

  • Thread starter Thread starter Clif McIrvin
  • Start date Start date
C

Clif McIrvin

A2010

I've been looking for a way to know when the user changes between form
and datasheet view without success.

Am I missing something obvious (an event?)

Any suggestions?

Clif
 
A2010

I've been looking for a way to know when the user changes between form
and datasheet view without success.

Am I missing something obvious (an event?)

Any suggestions?

Clif

I plugged the following code into the OnCurrent event.
Private Sub Form_Current()
MsgBox Me.CurrentView
End Sub

If flips between 1 and 2 when I toggle between form view and datasheet
view.
 
I plugged the following code into the OnCurrent event.
Private Sub Form_Current()
    MsgBox Me.CurrentView
End Sub

If flips between 1 and 2 when I toggle between form view and datasheet
view.

Thanks Patrick.

What I was/am looking for is a trigger so that I could know when the
view was changed.

What I have done is this:

Private Sub Form_Current()
With Me
Select Case .CurrentView = CInt(Val(.Tag)) 'did user change view?
Case False 'yes
Select Case .CurrentView
Case 1 'Form
' do stuff for change to form view
Case 2 'datasheet
' do stuff for change to datasheet view
End Select
.Tag = .CurrentView 'remember the current view
End Select
End With
End Sub

This way I'm testing every record change, but only processing when the
view actually changes.

Clif
 
Thanks Patrick.

What I was/am looking for is a trigger so that I could know when the
view was changed.

What I have done is this:

Private Sub Form_Current()
   With Me
   Select Case .CurrentView = CInt(Val(.Tag)) 'did user change view?
   Case False 'yes
      Select Case .CurrentView
      Case 1 'Form
           ' do stuff for change to form view
      Case 2 'datasheet
           ' do stuff for change to datasheet view
      End Select
      .Tag = .CurrentView 'remember the current view
   End Select
   End With
End Sub

This way I'm testing every record change, but only processing when the
view actually changes.

Clif- Hide quoted text -

- Show quoted text -

I might consider setting a Tempvar variable since it is global and
long lasting. And use that instead of your .Tag property.for
compartision.
 
Back
Top