Link to home
Start Free TrialLog in
Avatar of rhlopez1
rhlopez1

asked on

What property do I set in ACCESS 2007 to prevent users from moving fields around within a form in datasheet view?

I want to deny users the ability to move fields around in a form that is in a datasheet view.  I'd like to set this restriction without affecting other tools such as copy, paste, edit, delete, etc...

Thanks in Advance
rhlopez
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rhlopez1
rhlopez1

ASKER

Am I to understand that, in a form, in datasheet view, I cannot set this restriction?
Not as far as I know.
After all it's stuff like this that datasheets are for.  If the user finds it better to see things in a particular way, who is the developer to say they are wrong?

You can stop users adding fields and you can re-instate column positions whenever the form is opened using code.

Sub stopschemachanges()  ' applies to all datasheets in database - so run this from the startup form

On Error Resume Next

CurrentDb.Properties.Append CurrentDb.CreateProperty("AllowDatasheetSchema", vbBoolean, True)
CurrentDb.Properties("AllowDatasheetSchema") = False


End Sub

' setting column order in the form open event procedure

Me.firstcolumnname ColumnOrder = 1
Me.secondcolumnname.ColumnOrder = 2
and so on...you could use the same technique to set column widths.
you can freeze the columns

in the onload code of your datasheet put this code

DoCmd.RunCommand acCmdFreezeColumn

this will freeze the columns but if the user right clicks the form a right click menu will appear giving them the option of unfreezing the columns.
you can keep the right click menu from poping up by
going to the form property window click the "other" tab and change the "shortcut menu" option from yes to no.
Then you should have selected Pete's post.
;-)

I have requested that this be changed