Access 2000 -




6c.


 

, , .. , , , , -. , .

 

Public Function funRestoreFormControls(frm As Form) As Boolean

Dim ctl As Control, rst As Recordset, dbs As Database, i As Integer

 

On Error GoTo 999 '

funRestoreFormControls = False '

Set dbs = CurrentDb '

Set rst = dbs.OpenRecordset("SELECT * FROM [-]")

If rst.RecordCount = 0 Then '

rst.Close '

Exit Function '

End If

With rst '

.MoveLast '

.MoveFirst ' 1

For i = 0 To .RecordCount - 1 '

Select Case rst!ControlType

Case acCommandButton '

Set ctl = appAccess.CreateControl(frm.Name, rst!ControlType, , "", "", rst!Left, rst!Top, rst!Width, rst!Height)

ctl.OnClick = "[Event Procedure]" '

ctl.Caption = rst!Caption '

ctl.ControlTipText = rst!ControlTipText '

Case acLabel '

Set ctl = appAccess.CreateControl(frm.Name, rst!ControlType, , "", rst!Caption, rst!Left, rst!Top, rst!Width, rst!Height)

ctl.BackColor = !BackColor '

Case acTextBox '

Set ctl = appAccess.CreateControl(frm.Name, rst!ControlType, , "", "", rst!Left, rst!Top, rst!Width, rst!Height)

ctl.SpecialEffect = 0 '

ctl.BorderColor = 0 '

ctl.BorderStyle = 1 '

Case acListBox '

Set ctl = appAccess.CreateControl(frm.Name, rst!ControlType, , "", "", rst!Left, rst!Top, rst!Width, rst!Height)

ctl.SpecialEffect = 0 '

ctl.BackColor = rst!BackColor '

ctl.BorderColor = 0 '

ctl.ColumnCount = 2 '

ctl.ColumnWidths = "7,932 ;1 " '

ctl.RowSource = "" '

End Select

ctl.Name = rst!Name '

ctl.ForeColor = !ForeColor '

rst.MoveNext '

Next i

End With

rst.Close '

funRestoreFormControls = True '

Exit Function '

999:

MsgBox Err.Description '

Err.Clear '

End Function