• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1481
  • Last Modified:

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
0
lcha
Asked:
lcha
  • 3
  • 3
  • 3
  • +1
4 Solutions
 
Rey Obrero (Capricorn1)Commented:
close the form with

docmd.close acform, me.name, acsaveno

they can move the columns, but can not save it
0
 
Rey Obrero (Capricorn1)Commented:
or use a continuous form instead.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Is there some reason a user should not be able to move the columns? I ask because this is a very normal UI paradigm - if users see columns, they expect to be able to move them. I can't think of a good reason why users would NOT be able to move columns, but you may have a valid reason.

0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
BitsqueezerCommented:
Hi,

if you only want to make sure that the form will look like you designed it when the form is opened there is one simple method: Deploy the database with Access runtime. The user can go on moving the columns but the new arrangement can not be saved. After closing and reopening the column arrangement is as original designed.
I agree with LSMConsulting, the users I know would be thankful if I could make it possible to save the column arrangement with the runtime. But that belongs to "form design" and every function of this group doesn't work in the runtime edition (because of this you also can't for example use form based filter in the runtime).

Cheers,

Christian
0
 
lchaAuthor Commented:
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.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I don't think that acSaveNo would work for this, but I"m not sure. You can always specify the order in which your columns should be shown in the Open or Load event of your form:

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


0
 
Rey Obrero (Capricorn1)Commented:
open the datasheet form
select all columns, then right click select freeze columns

when satisfied, open the datasheet form in design view and set the shortcut menu property to NO
0
 
lchaAuthor Commented:
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.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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.
0
 
lchaAuthor Commented:
thanks all for being patient.   I
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 3
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now