Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A '3265' Error Message

Status
Not open for further replies.

jakeH

Programmer
Jun 25, 2002
7
GB
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) <> &quot;s_&quot; 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
 
Just use a SELECT INTO action query, and copying the table structure only all in one line of code. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Col is a reserved word (Datagrid.Col refers to the column object in a Datagrid)
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 

>Col is a reserved word (Datagrid.Col refers to the column object in a Datagrid)

Shouldn't matter here. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
I try and avoid the use of reserved words as variables as a matter of course. (I've been caught out too many times)
[smile]
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 

But johnwm, it isn't a reserved word...

It is a property/method name, preceeded with a full identifier.

If one was follow those guidlines, then no two classes are allowed to have the same public property/method names.
Not a flexible idea. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top