View

Pauldohert

Something in here
Local time
Today, 00:40
Joined
Apr 6, 2004
Messages
2,101
How do I get what is the current view of my form - ie datasheet , or form?

Thanks Paul
 
Man, open your form's properties and drop down the Default View Combobox.
There you get(Single form,Continous,datasheet....).
 
Sorry - I'll explain again - how do I code which view my form currently has - otherwise I could just look at it I suppose. :o
 
In the access help:

Example
The following example uses the GetCurrentView subroutine to determine whether a form is in Form or Datasheet view. If it's in Form view, a message to the user is displayed in a text box on the form; if it's in Datasheet view, the same message is displayed in a message box.

GetCurrentView Me, "Please contact system administrator."

Sub GetCurrentView(frm As Form, strDisplayMsg As String)
Const conFormView = 1
Const conDataSheet = 2
Dim intView As Integer
intView = frm.CurrentView
Select Case intView
Case conFormView
frm!MessageTextBox.SetFocus
' Display message in text box.
frm!MessageTextBox = strDisplayMsg
Case conDataSheet
' Display message in message box.
MsgBox strDisplayMsg
End Select
End Sub
 
No problem, I have done it many times. You search for things here or in the help file and don't have the wording right, and don't come up with anything you want.
 
A follow up question - now I know which view I am currently in is it possible to code a change to it.

I want the user to see the form as it was when they closed it - I have copied across the access toolbar buttons to a custom toolbar which allows me to change the view, but can I code it also. I have looked at the obviuos (to me candidtaes) in the help files but non seems to do what I want.

Is it a simple property of the form I can change - if it is what is it? Can these be remembered liked subdatasheetexpanded property?

Paul
 
Got it thanks DoCmd.RunCommand acCmdSubformDatasheet but this does not remember the last view.
 

Users who are viewing this thread

Back
Top Bottom