getting my layout in a datasheet form to stay

Sym

Registered User.
Local time
Today, 14:59
Joined
Feb 21, 2015
Messages
40
this is driving me bonkers, I have a datasheet form that is based off a query and is not editable due to expressions in the query. you might be asking why do you have a form that is not editable? well that's because the query im using has expression names that wouldn't be useful to another user and thus I need to edit them to read appropriate labels, thus the need to make it a form

Problem is.... I want to change the order of the fields and the widths of the fields but every time I load back in it has reverted back to its old state and looks horrid. I have found that if I change a value in my other datasheet forms after changing the layout it will save the layout but since I cant do that with this form I cant get the layout to stay

so how do I save the layout of my datasheet form and get it to stay?
 
Sometimes it help to open the form in "Design view", change a little, then without closing it show the form in "Form View", make the change you want and then save the form.
 
if I change a value in my other datasheet forms after changing the layout it will save the layout but since I cant do that with this form I cant get the layout to stay
temporarily allow this, do your layout changes, save and close. The reopen and disallow changes again
 
This is one of those things I wrote for a special reason a long time ago.

I thought I was lucky to find it again.

You need to do some testing to decide where you want to put it.

Code:
Public Sub DontMuckWithColumns()
 If (conHandleErrors) Then On Error GoTo ErrorHandler
  
   Me.Student_ID.ColumnOrder = 1
   Me.Family_Name.ColumnOrder = 2
   Me.Preferred_Name.ColumnOrder = 3
   Me.Status.ColumnOrder = 4
   Me.Grade.ColumnOrder = 5
   Me.Subject_Name.ColumnOrder = 6
   Me.Subject_Code.ColumnOrder = 7
   Me.Cohort.ColumnOrder = 8
   Me.Teacher_First.ColumnOrder = 9
   Me.Teacher_Last.ColumnOrder = 10
   Me.Sem_1.ColumnOrder = 11
   Me.Sem_2.ColumnOrder = 12
   Me.Sem_3.ColumnOrder = 13
   Me.Sem_4.ColumnOrder = 14
   Me.LOA_Mon.ColumnOrder = 15
   Me.Rung_Mon.ColumnOrder = 16
   Me.LOA_Exit.ColumnOrder = 17
   Me.Rung_Exit.ColumnOrder = 18
   Me.Exit_Date.ColumnOrder = 19
   Me.Sem_1_Result.ColumnOrder = 20
   Me.Sem_2_Result.ColumnOrder = 21
   Me.Sem_3_Result.ColumnOrder = 22
   Me.Sem_4_Result.ColumnOrder = 23
   Me.Date_Dropped.ColumnOrder = 24
   Me.Subject_Dropped.ColumnOrder = 25
   Me.Gender.ColumnOrder = 26
   Me.DOB.ColumnOrder = 27
   Me.Date_Enrolled.ColumnOrder = 28
   Me.Dept.ColumnOrder = 29
   Me.School_Previous.ColumnOrder = 30
   Me.School.ColumnOrder = 31
   Me.House.ColumnOrder = 32
   Me.Dual_Cohort.ColumnOrder = 33
   Me.VPR.ColumnOrder = 34
   Me.In_Sem_1_LOA.ColumnOrder = 35
   Me.In_Sem_1_Rung.ColumnOrder = 36
   Me.In_Sem_2_LOA.ColumnOrder = 37
   Me.In_Sem_2_Rung.ColumnOrder = 38
   Me.In_Sem_3_LOA.ColumnOrder = 39
   Me.In_Sem_3_Rung.ColumnOrder = 40
   Me.In_Sem_4_LOA.ColumnOrder = 41
   Me.In_Sem_4_Rung.ColumnOrder = 42
   Me.S1_Sent.ColumnOrder = 43
   Me.Date_S1_Sent.ColumnOrder = 44
   Me.S1_Print.ColumnOrder = 45
   Me.Last_Year.ColumnOrder = 46
    
ExitProcedure:
    Exit Sub
 ErrorHandler:
    DisplayError "DontMuckWithColumns", Me.Name
    Resume ExitProcedure
   
End Sub

Fully tested installed and running. About 5 plus years ago.
 
Thanks for the replies. I will keep that in mind if I run into this problem again but after mucking around for awhile I figured out a way.

I went to design view and added an unbound textbox, switched back to datasheet view, moved some columns around then added a value to the unbound column, saved and closed the form. When I loaded back in all the columns I moved around stayed where they were supposed to.
 
...
I went to design view and added an unbound textbox, switched back to datasheet view, moved some columns around then added a value to the unbound column, saved and closed the form. When I loaded back in all the columns I moved around stayed where they were supposed to.
More or less the solution I wrote. :)
 
Thanks for the replies. I will keep that in mind if I run into this problem again but after mucking around for awhile I figured out a way.

I went to design view and added an unbound textbox, switched back to datasheet view, moved some columns around then added a value to the unbound column, saved and closed the form. When I loaded back in all the columns I moved around stayed where they were supposed to.

Sym

One day you may find what I posted very handy.

You can set Column position and column width using similar code.

Just though I might throw that in as it may help one day.
 

Users who are viewing this thread

Back
Top Bottom