Hello Experts outhere,
may be someone can tell me whats going wrong with my ADOX trial.
I have an Access 2002 database with some tables and queries (views)
The code listed below works well up to the point where I want to add
the new view to the views collection. I get Runtime error 3001 which
is telling me
"Arguments are of wrong type,are out of acceptable range or conflict
with one another"
I should metion that the table I'm refering is a LINKED one (DB is
also an access 2002 db on the same machine). But I don't expect any
impact by that.
The listing of the views alreay existing (debug.print) works well,
menas the cnn1 and cat1 objects ar probaly OK.
Any idea is welcome
Rolf
Private Sub Command41_Click ()
Dim cnn1 As ADODB.Connectio n
Dim cmd1 As ADODB.Command
Dim cat1 As ADOX.Catalog
Dim v As ADOX.View
Set cnn1 = New ADODB.Connectio n
Set cmd1 = New ADODB.Command
Set cat1 = New ADOX.Catalog
Set cmd1.ActiveConn ection = CurrentProject. Connection
Debug.Print CurrentProject. Connection ' OK
'cmd1.CommandTy pe = adCmdText
cmd1.CommandTex t = "SELECT * FROM CallRecords_tab "
Set cat1.ActiveConn ection = CurrentProject. Connection
For Each v In cat1.Views
Debug.Print v.Name ' OK
Next
cat1.Views.Appe nd "NewView", cmd1 ' error 3001 !!
For Each v In cat1.Views
Debug.Print v.Name
Next
End Sub
may be someone can tell me whats going wrong with my ADOX trial.
I have an Access 2002 database with some tables and queries (views)
The code listed below works well up to the point where I want to add
the new view to the views collection. I get Runtime error 3001 which
is telling me
"Arguments are of wrong type,are out of acceptable range or conflict
with one another"
I should metion that the table I'm refering is a LINKED one (DB is
also an access 2002 db on the same machine). But I don't expect any
impact by that.
The listing of the views alreay existing (debug.print) works well,
menas the cnn1 and cat1 objects ar probaly OK.
Any idea is welcome
Rolf
Private Sub Command41_Click ()
Dim cnn1 As ADODB.Connectio n
Dim cmd1 As ADODB.Command
Dim cat1 As ADOX.Catalog
Dim v As ADOX.View
Set cnn1 = New ADODB.Connectio n
Set cmd1 = New ADODB.Command
Set cat1 = New ADOX.Catalog
Set cmd1.ActiveConn ection = CurrentProject. Connection
Debug.Print CurrentProject. Connection ' OK
'cmd1.CommandTy pe = adCmdText
cmd1.CommandTex t = "SELECT * FROM CallRecords_tab "
Set cat1.ActiveConn ection = CurrentProject. Connection
For Each v In cat1.Views
Debug.Print v.Name ' OK
Next
cat1.Views.Appe nd "NewView", cmd1 ' error 3001 !!
For Each v In cat1.Views
Debug.Print v.Name
Next
End Sub
Comment