Add the lines of code listed below to the function. Note that the
lines to be added begin with the characters $$.
NOTE: In the following sample code, an underscore (_) is used as a
line-continuation character. Remove the underscore from the end of the
line when re-creating this code in Access Basic.
Sub DumpTableInfo (TargetDB As String, SQLTarget1 As String, _
ObjOption As String, IsAttached As Integer)
CurrentProc = "DumpTableInfo"
'$$ New code begins - declare new variables
Dim F As Form, C As Control
'$$ New code ends
If Not TableExists(TargetDB, SQLTarget1) Then
'$$ New code begins - change the SQL to include Description
SQLSTRING$ = "Select TableName,Name,Type,Length,IndexName,_
Description Into [" & SQLTarget1 & "] in """ & TargetDB _
& """ From RLTables;"
'$$ New code ends
PerformSQLAction SQLSTRING$
End If
Set RT_Target = OpenDatabase(TargetDB)
Set RT_Database = CurrentDB()
Set RT_SysDB = CodeDB()
Set RT_Table2 = RT_Target.OpenTable(SQLTarget1)
Set RT_Dynaset1 = RT_Database.CreateDynaset(ObjOption)
Set RT_Snapshot1 = RT_Dynaset1.ListFields()
If Not IsAttached Then
Set RT_Table1 = RT_Database.OpenTable(ObjOption)
Set RT_Snapshot2 = RT_Table1.ListIndexes()
End If
'$$ New code begins - create a form in Design view
Set F = CreateForm()
'set the record source to the source table
F.RecordSource = ObjOption
'$$ New code ends
Do Until RT_Snapshot1.EOF
RT_Table2.AddNew
RT_Table2!TableName = ObjOption
RT_Table2!Name = RT_Snapshot1!Name
RT_Table2!Type = LookUpFieldType(RT_Snapshot1!Type)
RT_Table2!Length = RT_Snapshot1!Size
'$$ New code begins - create a control for this field
Set C = CreateControl(F.FormName, 109, 0, "", RT_Snapshot1!Name)
'save the description from the field
RT_Table2!Description = C.StatusBarText
'$$ New code ends
If Not IsAttached Then
' Cannot use FindFirst method on List Snapshots
If RT_Snapshot2.RecordCount > 0 Then
RT_Snapshot2.MoveFirst
Do Until RT_Snapshot2.EOF
If RT_Snapshot2!FieldName = RT_Snapshot1!Name Then _
Exit Do
RT_Snapshot2.MoveNext
Loop
If Not RT_Snapshot2.EOF Then
RT_Table2!IndexName = RT_Snapshot2!IndexName
End If
End If
End If
RT_Table2.Update
RT_Snapshot1.MoveNext
Loop
'$$ New code begins - close the form, say "No" to save changes
DoCmd SetWarnings True
SendKeys "n"
DoCmd Close A_FORM, F.FormName
'$$ New code ends
RT_CloseAllObjects
End Sub