Change AllowDatasheetView

D

Dave Hoder

I'm trying to change AllowDatasheetView to True with code but keep getting an
error that I have to be in design view to do this. I've tried
Me.AllowDatasheetView = True and Forms!frmECR.AllowDatasheetView = True but
both return the same error. Can someone tell me the right way to do this?
Thanks
Dave
 
D

Douglas J. Steele

You have to be in Design view to do it...

Assuming you've got your application split into a front-end (containing the
queries, forms, reports, macros and modules), linked to a back-end, with
each user having his/her own copy of the front-end, you can try opening the
form in Design mode, making your change, then switching the form from Design
mode.

Check OpenForm in the Help file for how you open a form in Design mode.

If your application isn't split, so that multiple users are sharing the same
MDB, you're out of luck (and you really should split it).

If your front-end is an MDE, not an MDB, you're out of luck.

Your only option would be to have 2 different versions of the same form (one
in datasheet view, the other not), and selecting the appropriate one.
 
D

Dave Hoder

Thanks Doug
It looks like Me.ViewsAllowed = 2 accomplishes what I'm after (I think). Now
can you tell me the vba command for changing views?
My goal is to allow a user to search a datasheet view with no edits allowed,
double click a record & go to form view to edit the record. I've already got
this done (with 2 separate forms) but the users want to be able to return to
the datasheet view from the form. I want to do this with a button instead of
the Access tool bar so they can return to any filtered & sorted view they may
have had. Do you have a better approach I may be overlooking?
Thanks again!
 
Top