Detect form view change to datasheet

coypu

Registered User.
Local time
Today, 11:01
Joined
Mar 12, 2019
Messages
33
Hi, how does one detect immediately a form is changed from normal to datasheet view?
 
You could add code like this:

Code:
Private Sub Form_Current()
    If Me.CurrentView = 2 Then MsgBox "Datasheet view"
End Sub

The full list of values are

Code:
Setting	Form displayed in:
0	Design view
1	Form view
2	Datasheet view
7	Layout view

Or you can prevent datasheet view completely in the form property sheet
 
Excellent, thanks Colin
I forgot about testing during the form's On Current event.
 

Users who are viewing this thread

Back
Top Bottom