Public Function basFieldList(tblName As String)
'Michael Red Documentation Tools 2/10/2003
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmd As ADODB.Command
Dim fld As Field
Dim Idx As Integer
Dim tdf As TableDef
Dim strSQL As String
Dim MyFldTyp As String
Dim Quo As String
Dim MyType As String
Quo = Chr(34)
If (Left(tblName, 3) = "XXX") Then
GoTo SkipTbl
End If
Set cnn = CurrentProject.Connection
If (blnFirstPass = True) Then
strSQL = "Delete tblFields.* from tblFields"
cnn.Execute strSQL
blnFirstPass = False
End If
Set rst = New ADODB.Recordset
rst.Open tblName, cnn, adOpenDynamic, , adCmdTable
'rstEmployees.Open "employee", cnn1, , , , adCmdTable
While Idx < rst.Fields.Count 'Not rst.EOF
MyType = basFldTyp(rst.Fields(Idx).Type)
strSQL = "Insert Into tblFields ("
strSQL = strSQL & "tblName, "
strSQL = strSQL & "fldName, "
strSQL = strSQL & "fldType "
If (rst.Fields(Idx).Type = adVarWChar) Then
strSQL = strSQL & ", "
strSQL = strSQL & "fldLen "
End If
strSQL = strSQL & ") "
strSQL = strSQL & "Values ("
strSQL = strSQL & Quo & tblName & Quo & ", "
strSQL = strSQL & Quo & rst.Fields(Idx).Name & Quo & ", "
strSQL = strSQL & Quo & MyType & Quo
If (rst.Fields(Idx).Type = adVarWChar) Then
strSQL = strSQL & ", "
strSQL = strSQL & rst.Fields(Idx).DefinedSize
End If
strSQL = strSQL & ")"
cnn.Execute strSQL
SkipFld:
Idx = Idx + 1
Wend
SkipTbl:
End Function