Row Height of subform reverts back (1 Viewer)

jco23

Registered User.
Local time
Today, 06:42
Joined
Jun 2, 2015
Messages
76
i am a developer for a database app that gets used by 500+ users.

users install the frontend on their desktop and use that exclusively. once I make updates, the app then automatically re-installs when they open it.

within this app, I have a form with two subforms (both are shown as datasheet view). up until recently, users were able to adjust the row height of these subforms and that height would stick for them even after they close the form.
for example, I set the row height to 15. the user will increase it to 20. the row height of 20 will stick for that particular user until they re-install the database.

however, the row height seems to revert back each time they close the form.

I see this is NOT the case on another form that I have (but that has just one subform in datasheet view).

I've reviewed the "form_open" properties for each of the forms (as well as the subforms), and nothing changed nor contains anything about the row height.
I'm not sure what I did to get it to revert back each time, but the users prefer to have their own customized row height.

how do I get it to NOT revert back? could this be a setting within Access itself?

thanks!
 
Do you have any “save” code in your form/subform? I don’t recall ever experiencing a row height saving after closing a form.
 
Do you have any “save” code in your form/subform? I don’t recall ever experiencing a row height saving after closing a form.
the only "save" codes pertain to the records, not the forms. but just closing the form does not contain any events.
 
maybe you can save the Form when you close it:
Code:
Docmd.Close acForm,me.name,acSaveYes

or maybe your form got corrupted. try rebuilding the two subforms.
 
sorry, i tested on single datasheet subform and it does save the height.
tested on two subform and it does Reset it's size back when opened the Main form again.
what you can do is add another table to your db (tblRowHeight) with following fields:

FormName (short text)
RowHeight (long integer)

now on both subform, add this to their Load and Unload event:
Code:
Private Sub Form_Load()

    Dim vHeight As Variant
    vHeight = DLookup("RowHeight", "tblRowHeight", "FormName='" & Me.Name & "'")
    If Not IsNull(vHeight) Then
        Me.RowHeight = vHeight
    End If
    
End Sub

Private Sub Form_Unload(Cancel As Integer)

    With CurrentDb
        If DCount("1", "tblRowHeight", "FormName='" & Me.Name & "'") = 0 Then
            .Execute "Insert Into tblRowHeight (FormName, RowHeight) Select '" & Me.Name & "'," & Me.RowHeight & ";"
        Else
            .Execute "Update tblRowHeight Set RowHeight = " & Me.RowHeight & " Where FormName = '" & Me.Name & "';"
        End If
    End With
    
End Sub

this will "remember" their row heights.
 
sorry, i tested on single datasheet subform and it does save the height.
tested on two subform and it does Reset it's size back when opened the Main form again.
what you can do is add another table to your db (tblRowHeight) with following fields:

FormName (short text)
RowHeight (long integer)

now on both subform, add this to their Load and Unload event:
Code:
Private Sub Form_Load()

    Dim vHeight As Variant
    vHeight = DLookup("RowHeight", "tblRowHeight", "FormName='" & Me.Name & "'")
    If Not IsNull(vHeight) Then
        Me.RowHeight = vHeight
    End If
   
End Sub

Private Sub Form_Unload(Cancel As Integer)

    With CurrentDb
        If DCount("1", "tblRowHeight", "FormName='" & Me.Name & "'") = 0 Then
            .Execute "Insert Into tblRowHeight (FormName, RowHeight) Select '" & Me.Name & "'," & Me.RowHeight & ";"
        Else
            .Execute "Update tblRowHeight Set RowHeight = " & Me.RowHeight & " Where FormName = '" & Me.Name & "';"
        End If
    End With
   
End Sub

this will "remember" their row heights.
i'll see if that is feasible.
thanks for the quick responses and extended effort!
 

Users who are viewing this thread

Back
Top Bottom