open form in datasheet view (1 Viewer)

steve111

Registered User.
Local time
Today, 08:09
Joined
Jan 30, 2014
Messages
429
hi.

I have a form that whe opened it opens in datasheet view
but when I open it with this code if opens in form view
could you please help me so that it opens in datasheet view from my code



Code:
Private Sub Command375_Click()
 Dim strInput As String
Dim strMsg As String
 Beep
strMsg = "Please Enter  the password to allow access."
strInput = InputBox(Prompt:=strMsg, Title:="Production Password")
If strInput = "Phil" Then
MsgBox "Password accepted! Welcome!     " & "Phil " 'password is correct'password is correct'password is correct
DoCmd.OpenForm " What if "
DoCmd.Close acForm, Me.Name
ElseIf strInput = "" Then
 Else 'password is incorrect
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the ''Inspection form''.", vbCritical, "Invalid Password"
Exit Sub
End If
End Sub


thanks
steve
 

ByteMyzer

AWF VIP
Local time
Today, 01:09
Joined
May 3, 2004
Messages
1,409
Change:
Code:
DoCmd.OpenForm "What if"
...to:
Code:
DoCmd.OpenForm "What if", acFormDS
 

RuralGuy

AWF VIP
Local time
Today, 02:09
Joined
Jul 2, 2005
Messages
13,826
The syntax for the OpenForm command is:
DoCmdOpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)
The arguments for the View are:
AcFormView can be one of these AcFormView constants.
acDesign
acFormDS
acFormPivotChart
acFormPivotTable
acNormal default. Opens the form in Form view.
acPreview
If you leave this argument blank, the default constant (acNormal) is assumed.
 

Users who are viewing this thread

Top Bottom