Toggle View in SubForm

R

rbb101

I have a subform with a tab control that I would like to toggle between form
view and datasheet view. Is there an easy way to accomplish this. I tried
the following code, but changes the master form, not the subform within the
tab.

Select Case Screen.ActiveForm.CurrentView
Case 1
' Currently in form view
RunCommand acCmdDatasheetView
Case 2
' Currently in datasheet view
RunCommand acCmdFormView
Case Else
' Must be design view (0) or some as yet undefined view
' Do nothing.
End Select

I would like the datasheet view and form view to stay as a subform within
the tab, within the master form.

Thanks.
 
R

roger

While I'v never done *that* before, if your code works just on the wrong
form, have you tried replacing the "screen.Activeform" with hardcoding the
foms name and property?
As in:
Forms!Mainform.SubFormName.Form.currentview=1
(or 2 or 3)

hth
 

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.

Ask a Question

Top