Lou Dufresne
asked on
MS Access 2013 - form VBA to toggle between Datasheet and Form View
I am working in MS access 2013 and need VBA code that will allow me to determine if the subform that I am on is a datasheet or a form.
What I am trying to do is allow the user to click on the subform field "Reporting_Year" and have the subform switches to a subform datasheet and then when the user clicks on the same subform field "Reporting_Year the subform switches from a subform back to a datasheet.
The main Form is titled: F-100-00 StartUpMain
The Subform is titled: F-100-01 CFR_Pivot -All Records
Example:
Private Sub REPORTING_YEAR_DblClick(Ca ncel As Integer)
If Form.subform is a datasheet then
DoCmd.RunCommand acCmdSubformFormView
else if
Form.subform is SubformFormView then
DoCmd.RunCommand acCmdSubformDatasheetView
end if
End Sub
Any assistance will be appreciated
Ldufresne
What I am trying to do is allow the user to click on the subform field "Reporting_Year" and have the subform switches to a subform datasheet and then when the user clicks on the same subform field "Reporting_Year the subform switches from a subform back to a datasheet.
The main Form is titled: F-100-00 StartUpMain
The Subform is titled: F-100-01 CFR_Pivot -All Records
Example:
Private Sub REPORTING_YEAR_DblClick(Ca
If Form.subform is a datasheet then
DoCmd.RunCommand acCmdSubformFormView
else if
Form.subform is SubformFormView then
DoCmd.RunCommand acCmdSubformDatasheetView
end if
End Sub
Any assistance will be appreciated
Ldufresne
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
Ldufressne