|
再增加一个动态生成行来源
Private Sub Form_Load()
Dim rs As New ADODB.Recordset
Dim strListTRowSource As String
Dim strListDRowSource As String
Dim i As Integer
With rs
.Open "A", CurrentProject.Connection, adOpenKeyset, adLockReadOnly
For i = 0 To .Fields.Count - 1
If .Fields(i).Type = 202 Then
strListTRowSource = strListTRowSource & .Fields(i).Name & ";"
ElseIf .Fields(i).Type = 3 Then
strListDRowSource = strListDRowSource & .Fields(i).Name & ";"
End If
Next
Me.List0.RowSourceType = "Value List"
Me.List2.RowSourceType = "Value List"
Me.List0.RowSource = strListTRowSource
Me.List2.RowSource = strListDRowSource
.Close
End With
Set rs = Nothing
End Sub |
|