303factory
Registered User.
- Local time
- Today, 13:05
- Joined
- Oct 10, 2008
- Messages
- 136
I have a bit of a problem with switching between form view and datasheet view now my main form has two subforms
I used to use the following code
This worked fine for ages but now I've got two subforms, I now get the error
'The command or action 'SubformDataSheetView' isnt available now.
I tried putting moving the button onto the header of the subform I want changed. The code now works, but as soon as you switch to datasheet view the header and the button dissapear so you cant switch back!
Anyone able to help with this? been on my todo list for ages and im really stuck
303
I used to use the following code
Code:
Private Sub btnSwitchView_Click()
intview = Me.DisplayPanel.Form.CurrentView
' change view
If intview = 1 Then
DoCmd.RunCommand acCmdSubformDatasheetView
End If
If intview = 2 Then
DoCmd.RunCommand acCmdSubformFormView
End If
End Sub
This worked fine for ages but now I've got two subforms, I now get the error
'The command or action 'SubformDataSheetView' isnt available now.
I tried putting moving the button onto the header of the subform I want changed. The code now works, but as soon as you switch to datasheet view the header and the button dissapear so you cant switch back!
Anyone able to help with this? been on my todo list for ages and im really stuck
303