The easiest way is to change the defaultView property in the property sheet.
From code you can use DoCmd.RunCommand acCmdSubformDatasheetView *after* you
setfocus to the subform control. Here's some sample code that goes in a
button click event for a button on the main form:
Private Sub Command16_Click()
Static fdatasheet As Boolean
Me.order_subform.SetFocus
If fdatasheet Then
DoCmd.RunCommand acCmdSubformDatasheetView
Else
DoCmd.RunCommand acCmdSubformFormView
End If
fdatasheet = Not fdatasheet
End Sub
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.