Link to home
Start Free TrialLog in
Avatar of lcha
lchaFlag for United States of America

asked on

prevent user from moving columns in form datasheet view

Hello experts,

I am working with an MS Access 2007 form that displays has its property default view set to datasheet.   The forms controlsource is set to a sql statement and the textbox controls on it are bound to the datasource or date retrieved from the sql.

I noticed that when I open this form (in datasheet view), there is nothing preventing a user from changing the ordering of columns.    It's easy for any person using the form to click on a column, select it, and drag to another location.    I need to prevent users from making any changes to the display of the datasheet.

Is there a property of the form that will prevent this?    I've already tried setting "moveable" property to No, "allow edits" property is set to no as well but neither, prevents a user from changing the order of columns.   Please let me know if any clarification is needed.

Thanks!   lcha
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

close the form with

docmd.close acform, me.name, acsaveno

they can move the columns, but can not save it
or use a continuous form instead.
SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America 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
SOLUTION
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 lcha

ASKER

Hi All,

thanks for the feedback..

Actually it would be fine that users can rearrange columns.   I just want to make sure that everything is back in place as initially started after closing and reopening the form.    

capricorn1 - regarding
docmd.close acform, me.name, acsaveno    (not sure where this code should go on my form)

User has the option to close the form by clicking on the X in the upper right hand side of the form.    After closing the form, and reopening, all rearrangement or movement of any columns remains.
ASKER CERTIFIED SOLUTION
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
SOLUTION
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 lcha

ASKER

apologies for the delay thanks everyone for the feedback, got pulled into some other work and didn't get the chance to respond on this in a timely manner.

LSMConsulting - you got me thinking that maybe I should allow users the ability to sort and move columns.  

your most recent suggestion almost works for me.   I noticed though that if I make a change (e.g. move column) close the form and reopen.  The change to the column remains when it seems that the onload event should have set the column order back ... it only goes back to how it should be after moving the horizontal scroll bar of the form.   For some reason that seems to be activating putting the columns back in the order I specified in the form load.

Me.YourFirstColumn.ColumnOrder = 1
Me.YourSecondColumn.ColumnOrder = 2
etc etc

Capricorn1- thanks, the suggestion you provided will also work.  

bitsqueezer - thank you, I will look further into the access runtime.
I can't tell you why that happens, but it would seem to be a glitch in the interface. You could always force the order in the Open event of the form, if it's important.
Avatar of lcha

ASKER

thanks all for being patient.   I