Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Verifying a Subform's Current View (Datasheet or Form) 1

Status
Not open for further replies.

majors479

Technical User
Jul 5, 2008
16
US
Good morning,

I am attempting to freeze a column is a form's subform. I have a button within the main form that allows the user to change the view of the subform from datasheet to single form view. I've added the code to freeze the subform's column to the change view button, but receive an error when the subform's view is being changed to single form. This makes sense.

My question is how would I verify in an If statement that the subform's view is currently datasheet in the below statement in order to not freeze the first column when changing to single form?
Code:
If Forms!Mainform!Subform  "Current view is Datasheet" Then

   Forms!Mainform!Subform.SetFocus
   DoCmd.RunCommand acCmdSubformDatasheet
 
Else
   Forms!Mainform!Subform.SetFocus
   DoCmd.RunCommand acCmdSubformDatasheet
   DoCmd.RunCommand acCmdFreezeColumn 

End If

Thanks so much for your assistance

Sydney
 
look at the "currentview" property.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top