|
'=========================================================------>>>>>>>>
'-函数名: gt_SetDataSheetColumn
'-描述: 设置数据表子窗体栏位宽度和是否隐藏
'-参数: Parameter1: rfrm Form rsfm subForm
Parameter2: rstrFormName String
'-Return: None
'-作者 tmtony
'=========================================================--<>>>>>
Public Function gt_SetDataSheetColumn(rfrm As Form, rstrFormName As String, Optional intMode As Integer = 0)
Dim i As Integer, strTag As String
Dim ctr As Control
Dim frmSubForm As Control
Dim strSubFormName As String
Dim strCtrCaption As String
For Each ctr In rfrm.Section(acDetail).Controls
If TypeOf ctr Is SubForm Then
Set frmSubForm = ctr
strSubFormName = ctr.Form.name
Exit For
End If
Next
If intMode <> 0 Then
frmSubForm.SetFocus
DoCmd.RunCommand acCmdUnhideColumns
Exit Function
End If
Dim rst As New ADODB.Recordset
rst.Open "select * from tblZstmColumnProperty where FFormName='" & rstrFormName & "' order by FSeqNo", CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rst.RecordCount <= 0 Then
rst.Close
Set rst = Nothing
Exit Function
End If
For i = 0 To rst.RecordCount - 1
Set ctr = frmSubForm.Form.Controls(rst("FControlName"))
ctr.ColumnHidden = Not rst("FIsSelect")
ctr.ColumnWidth = rst("FColumnWidth")
ctr.ColumnOrder = rst("FSeqNo")
rst.MoveNext
Next
Set rst = Nothing
Set ctr = Nothing
Set frmSubForm = Nothing
End Function
|
|