Hi,
Hope someone can help me. I'm getting a 3265 error message and when I execute my program VB6 stops on the "Set COL = TBL.Columns(FLD.Name)" line.
All I want to do is copy a table format from one dAccess db to a new Access db that my program creates.
Any thoughts? I've tried a number of things and nothing seems to work.
Thanks.
Public Sub writetable(TBL As ADOX.Table)
Dim TableName As String
TableName = TBL.Name
Dim RS As ADODB.Recordset
Dim FLD As ADODB.Field
Dim COL As ADOX.Column
Set RS = New ADODB.Recordset
RS.Source = "SELECT * FROM [" & TableName & "] WHERE 0=1"
RS.Open , mCon, adOpenForwardOnly, adLockReadOnly, adCmdText
Set RS.ActiveConnection = Nothing
Set TBL = New ADOX.Table
Set TBL.ParentCatalog = CAT
For Each FLD In RS.Fields
If Left$(FLD.Name, 2) <> "s_" Then 'ignore the system columns...
Set COL = TBL.Columns(FLD.Name)
TBL.Columns.Append COL.Name, cType(COL.Type), COL.DefinedSize
End If
Next
CAT.Tables.Append TBL
RS.Close
Set RS = Nothing
End Sub
Hope someone can help me. I'm getting a 3265 error message and when I execute my program VB6 stops on the "Set COL = TBL.Columns(FLD.Name)" line.
All I want to do is copy a table format from one dAccess db to a new Access db that my program creates.
Any thoughts? I've tried a number of things and nothing seems to work.
Thanks.
Public Sub writetable(TBL As ADOX.Table)
Dim TableName As String
TableName = TBL.Name
Dim RS As ADODB.Recordset
Dim FLD As ADODB.Field
Dim COL As ADOX.Column
Set RS = New ADODB.Recordset
RS.Source = "SELECT * FROM [" & TableName & "] WHERE 0=1"
RS.Open , mCon, adOpenForwardOnly, adLockReadOnly, adCmdText
Set RS.ActiveConnection = Nothing
Set TBL = New ADOX.Table
Set TBL.ParentCatalog = CAT
For Each FLD In RS.Fields
If Left$(FLD.Name, 2) <> "s_" Then 'ignore the system columns...
Set COL = TBL.Columns(FLD.Name)
TBL.Columns.Append COL.Name, cType(COL.Type), COL.DefinedSize
End If
Next
CAT.Tables.Append TBL
RS.Close
Set RS = Nothing
End Sub