473,717 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADOX error

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
Nov 12 '05 #1
3 10178
The only thing you are doing differently from what I would is setting the
ActiveConnectio n of the command object to something other than the instance
of the catalog you have declared. Try:

Private Sub Command41_Click ()
Dim cat1 As ADOX.Catalog
Dim cmd1 As ADODB.Command

Set cat1 = New ADOX.Catalog
Set cmd1 = New ADODB.Command

Set cat1.ActiveConn ection = CurrentProject. Connection
cmd1.CommandTex t = "SELECT * FROM CallRecords_tab ;"

cat1.Views.Appe nd "NewView", cmd1
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"KemperR" <Ke*****@t-online.de> wrote in message
news:90******** *************** ***@posting.goo gle.com...
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

Nov 12 '05 #2
Allen,
thanks a lot for the tip. Its working now! But this leads to a very
general question for me.
Imagine I have a shared DB or the DB is on a server and will be
instanciated several times.

In my undestanding the newly created view is visble to all users.

In case the name of the view is always the same and just the cmd
string will change entries can be overwritten by the users which are
loged in on the same access db.

Can I create private views in memory or such things ?

My target is to create some SQL statement execute it and present it to
the user like opening an existing query.

Ok, I can execute a command and assign the result to a recordset. But
how to make the recordset visible like running a query. Creating a
dynamic form with all the fields seams to be a big task. Or is there
some approch to do that in an easy way?
What is the best way to achieve that functionality ?
Thanks a lot for your help

Rolf

"Allen Browne" <ab************ ***@bigpond.net .au> wrote in message news:<P6******* ************@ne ws-server.bigpond. net.au>...
The only thing you are doing differently from what I would is setting the
ActiveConnectio n of the command object to something other than the instance
of the catalog you have declared. Try:

Private Sub Command41_Click ()
Dim cat1 As ADOX.Catalog
Dim cmd1 As ADODB.Command

Set cat1 = New ADOX.Catalog
Set cmd1 = New ADODB.Command

Set cat1.ActiveConn ection = CurrentProject. Connection
cmd1.CommandTex t = "SELECT * FROM CallRecords_tab ;"

cat1.Views.Appe nd "NewView", cmd1
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"KemperR" <Ke*****@t-online.de> wrote in message
news:90******** *************** ***@posting.goo gle.com...
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

Nov 12 '05 #3
Are you aware of the technique of splitting a database into back end (tables
only) and front end (separate mdb file containing the queries, form,
reports, and code, and linked tables)?

Each user gets their own copy of the front end, so you can do whatever you
like: the objects (including views) are completely independent of other
users.

Personally I do not permit the user to open tables and queries/view
directly. Forms are the appropriate interface. A form in Datasheet view
looks the same kind of interface as a query, but gives you much more control
(through the events). You can assign any SQL statement directly to the
RecordSource of the form and you don't need to create a view.

It is also possible to assign a recordset to the form, but I don't see the
advantage in that for the case you describe.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"KemperR" <Ke*****@t-online.de> wrote in message
news:90******** *************** ***@posting.goo gle.com...
Allen,
thanks a lot for the tip. Its working now! But this leads to a very
general question for me.
Imagine I have a shared DB or the DB is on a server and will be
instanciated several times.

In my undestanding the newly created view is visble to all users.

In case the name of the view is always the same and just the cmd
string will change entries can be overwritten by the users which are
loged in on the same access db.

Can I create private views in memory or such things ?

My target is to create some SQL statement execute it and present it to
the user like opening an existing query.

Ok, I can execute a command and assign the result to a recordset. But
how to make the recordset visible like running a query. Creating a
dynamic form with all the fields seams to be a big task. Or is there
some approch to do that in an easy way?
What is the best way to achieve that functionality ?
Thanks a lot for your help

Rolf

"Allen Browne" <ab************ ***@bigpond.net .au> wrote in message

news:<P6******* ************@ne ws-server.bigpond. net.au>...
The only thing you are doing differently from what I would is setting the ActiveConnectio n of the command object to something other than the instance of the catalog you have declared. Try:

Private Sub Command41_Click ()
Dim cat1 As ADOX.Catalog
Dim cmd1 As ADODB.Command

Set cat1 = New ADOX.Catalog
Set cmd1 = New ADODB.Command

Set cat1.ActiveConn ection = CurrentProject. Connection
cmd1.CommandTex t = "SELECT * FROM CallRecords_tab ;"

cat1.Views.Appe nd "NewView", cmd1
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"KemperR" <Ke*****@t-online.de> wrote in message
news:90******** *************** ***@posting.goo gle.com...
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

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2050
by: TJS | last post by:
can't seem to get this ADOX code to add columns to existing Access 2000 table what's missing ? Sub AddTableFields() Set tbl = Server.CreateObject("ADOX.Table") set cat = Server.CreateObject("ADOX.Catalog") cat.activeConnection = conn
2
7845
by: Randy | last post by:
I am trying to relink some Oracle tables in an Access database via VB.NET and ADOX. I receive the following error when executing the cat.ActiveConnection link "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. Here is my code Dim cat As ADOX.Catalog = New ADOX.Catalo Dim tbl As ADOX.Tabl Dim OracleConn As String = "Provider=MSDAORA.1;Data Source=xzy;User ID=xyz;Password=xyz
5
2075
by: Wayne Wengert | last post by:
I am getting an error that "object no longer valid" at the point indicated in the code below - I am trying to build a table in an Access 2000 database using ADOX. Any thoughts on what might cause this? ==================== code ================= Sub CreateADOUnitsTable(ByVal sTablename As String) Dim oDB As ADOX.Catalog Dim oUnits As ADOX.Table
6
9175
by: Michael | last post by:
I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncrement property to the ContactId column. I am experiencing a Property 'item' is ReadOnly error within the below line .Columns("ContactId").Properties("AutoIncrement") = True Am I missing a reference or what am I doing wrong?????
2
5521
by: genojoe | last post by:
Using ADOX to update a Property does not work. I want to change the Access database for a linked table. My abridged code is: Dim oCAT As ADOX.Catalog oCAT = New ADOX.Catalog oCAT.ActiveConnection = goConnection Dim t As ADOX.Table Dim p As ADOX.Property
3
3564
by: Miro | last post by:
Something weird I have run into when trying to add a boolean field to an Access table by code. -Just wondering if anyone else has run into this. ( vb.net 2005 express ) If I add any other field other than boolean the "command" version of adding a field works great. But if I try to add a boolean field, I get an exception error when its trying to be added, so instead I have to use the function meathod. -Code is below.
4
2911
devonknows
by: devonknows | last post by:
Hi can any one please help me with creating a secure database with ADO or ADOX if possible, ive got this code already but its not accessible through VisData so i cant easily modify it at all. Public Function CreateDatabase() Dim cat As ADOX.Catalog Dim tbl As ADOX.Table Dim con As ADODB.Connection On Error Resume Next Kill txtDatabaseName.Text
0
1132
parshupooja
by: parshupooja | last post by:
Hey all, I have Arraylist where I have stored names of Tables.I have two datasources one is SQL and one is Access, they have equal number of tabels. I am trying to find Access databse column and datatypes matches to Sql columns and their datatypes not. I am using Adox and unable to understand what shd I do next. here is code adn throws error on bold 'column' place Error Cannot convert type 'char' to 'ADOX.Columns' private void...
2
3382
by: mouac01 | last post by:
I can't set the field description property with the code below. I get the error "Item cannot be found in the collection corresponding to the requested name or ordinal". Any ideas. TIA... Sub Test() Dim cat As ADOX.Catalog Dim tbl As ADOX.Table Dim col As ADOX.Column Set cat = New Catalog
0
8823
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9348
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9202
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9109
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6648
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5970
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4478
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4739
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2545
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.