Knowing when user changes form view

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
 
P

Patrick Finucane

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.
 
C

Clif McIrvin

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
 
P

Patrick Finucane

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.
 

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