Thanks for the idea. Recreating all the forms is not realistic, but it prompted what I've done to investigate.
I remade one data sheet subform, so it had no coding behind it. It seemed that the problem was solved, UNTIL I added the coding. So… I commented out the code, and sequentially UNcommented line by line.
At the stage below, rearranged columns (and changes to column width) ARE retained upon closing:
Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Dim dtDefoltTD, dtDefoltNT As Date 'TD is TargetDate, NT is NextTarget
Dim lngRecNum As Long
Dim dtFirst, dtCurr As Date
DoCmd.SetWarnings False
'need to ensure weights are right due to calorie usage calculations
DoCmd.OpenQuery "TargetsCalcWeightsQ"
If DateAdd("d", 7, DMax("TDate", "TargetsEXT")) > Int(Now()) Then
dtDefoltTD = DateAdd("d", 7, DMax("TDate", "TargetsEXT"))
Else
dtDefoltTD = Int(Now())
End If
dtDefoltNT = DateAdd("d", 7, dtDefoltTD)
' TDate.DefaultValue = "#" & Format(dtDefoltTD, "mm\/dd\/yyyy") & "#"
' NextTDate.DefaultValue = "#" & Format(dtDefoltNT, "mm\/dd\/yyyy") & "#"
' lngRecNum = DCount("Tdate", "TargetsEXT")
' 'safety procedure to set every record's NextTDate to be equal to the next TDate.
' If lngRecNum > 1 Then
' dtFirst = Me.TDate
' DoCmd.GoToRecord acActiveDataObject, , acLast
' dtCurr = Me.TDate
'
' Do Until dtCurr = dtFirst
' DoCmd.GoToRecord acActiveDataObject, , acPrevious
'
' If Me.NextTDate <> dtCurr Then
' Me.AllowEdits = True
' Me.NextTDate = dtCurr
' DoCmd.Save acDefault
' End If
'
' dtCurr = Me.TDate
' Loop
' End If
Exit_Form_Open:
DoCmd.SetWarnings True
Exit Sub
Err_Form_Open:
MsgBox "Form_TargetsEXT subform, Form_Open, Error number: " & Err.Number & vbNewLine & Err.Description
Resume Exit_Form_Open
End Sub
As soon as the next line (also given below) is UNcommented, any rearrangement or change to widths of columns is NOT retained upon closing.
Code:
' TDate.DefaultValue = "#" & Format(dtDefoltTD, "mm\/dd\/yyyy") & "#"
Any more great ideas?