Datasheet column sizes sorts and filters (1 Viewer)

Status
Not open for further replies.

speakers_86

Registered User.
Local time
Today, 04:38
Joined
May 17, 2007
Messages
1,919
Hello all. I wrote a module to manage datasheets more easily. It allows developers to set the columns simply by using the tag of the form and the controls. When the end users apply filters, sorts, or change the column widths, these settings are saved and loaded the next time the form is opened. Here is a description of the appropriate tags to use in csv (semi-colon) format:

Form Properties:
RowH - this is used to set the default row height of the datasheet. Enter a whole number with a percentage sign or a whole number. A percentage sign will calculate the row height based on the height of the form itself.

FontH - Controls the font height. Use a whole number.

ex: RowH=33%;FontH=15

Control Properties:
H - Boolean property that shows or hides the control. Enter 1 or 0.
O - Sets the order of the column.
W - Sets the width of the column. Can be a whole number percentage from 0 to 99 with a percent sign or a whole number.

ex: H=1;O=1
ex: H=0;O=2;W=50%
ex: H=0;O=3;W=50%

The nice thing is that when the user sets a filter, sort, or changes column widths, these settings are saved in the front end in a local table. This way different users can view data as they please. To integrate this into your forms, you only need the following private subs. The public subs are optional ways to manipulate this through other means when necessary.

Code:
Private Sub Form_Resize()
    SetDefaultColumnInfo Me
    LoadColumnInfo Me, True, True
End Sub

Private Sub Form_Unload(Cancel As Integer)
    SaveColumnInfo Me
End Sub


Public Sub ResetColumns()
    SetDefaultColumnInfo Me
    Me.FilterOn = False
    Me.OrderByOn = False
End Sub

Public Sub LoadColumns(Optional booOrders As Boolean = True, Optional booFilters As Boolean = True)
    LoadColumnInfo Me, booOrders, booFilters
End Sub



I would not say that I have tested this thoroughly, but it certainly seems to work as expected. If you find any bugs, please let me know. One small issue that when the SetDefaultColumnInfo routine runs for the first time, the form should be closed and opened again for it to work as expected. The only reason for this is that in the first run, the local table is created. It should work on subsequent openings.
 

Attachments

  • Save Column Info.mdb
    1 MB · Views: 950
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom