Home All Groups Group Topic Archive Search About
Author
1 Jun 2005 5:29 PM
cliff
I'm creating a VB6 application to import data from a temp Access database to
a production Access database. I have set up a Data Enviorment to communicate
with my production database since I the application centers around it.
During the import I create a temporary connection to connect to the temp
database.

The application is cycle through the records in the temp database and then
import the records that do not exist into the production database. When I
run the application to test it I get a run time error #3705, Operation is
not allowed when the object is open.

I get that error when this part of the code executes, DE.FindOrderByRef
rsNew("orderID").
That is executing a command I have set up in my Data Enviornment to simply
find out if that order is in our production database.

I have searched various website and news groups but couldn't find anything
that would help. Unfortunately this simple action is key to the larger
application. Any help would be apprceciated.

I have tried a few different newsgroups but I haven't gotten any replies.

------------------------- CODE -------------------------------------------

    Dim tempConn As New ADODB.Connection
    Dim rsNew As New ADODB.Recordset

    tempConn.Open "ImportOfflineOrders"

    rsNew.ActiveConnection = tempConn
    rsNew.Open "NewOrders"

    Do Until rsNew.EOF

        DE.FindOrderByRef rsNew("orderID")

        Debug.Print DE.rsFindOrderByRef.RecordCount

        rsNew.MoveNext

    Loop

Author
2 Jun 2005 4:33 PM
cliff
Figured it out after sometime.

>         DE.FindOrderByRef rsNew("orderID")
>
>         Debug.Print DE.rsFindOrderByRef.RecordCount
>
>         rsNew.MoveNext

Must close the recordset before opening it again. Thought I was happening
automatically.
Show quoteHide quote
"cliff" <no@nospamn.com> wrote in message
news:uJWJM8sZFHA.796@TK2MSFTNGP09.phx.gbl...
> I'm creating a VB6 application to import data from a temp Access database
to
> a production Access database. I have set up a Data Enviorment to
communicate
> with my production database since I the application centers around it.
> During the import I create a temporary connection to connect to the temp
> database.
>
> The application is cycle through the records in the temp database and then
> import the records that do not exist into the production database. When I
> run the application to test it I get a run time error #3705, Operation is
> not allowed when the object is open.
>
> I get that error when this part of the code executes, DE.FindOrderByRef
> rsNew("orderID").
> That is executing a command I have set up in my Data Enviornment to simply
> find out if that order is in our production database.
>
> I have searched various website and news groups but couldn't find anything
> that would help. Unfortunately this simple action is key to the larger
> application. Any help would be apprceciated.
>
> I have tried a few different newsgroups but I haven't gotten any replies.
>
> ------------------------- CODE -------------------------------------------
>
>     Dim tempConn As New ADODB.Connection
>     Dim rsNew As New ADODB.Recordset
>
>     tempConn.Open "ImportOfflineOrders"
>
>     rsNew.ActiveConnection = tempConn
>     rsNew.Open "NewOrders"
>
>     Do Until rsNew.EOF
>
>         DE.FindOrderByRef rsNew("orderID")
>
>         Debug.Print DE.rsFindOrderByRef.RecordCount
>
>         rsNew.MoveNext
>
>     Loop
>
>
>
>
Author
2 Jun 2005 4:34 PM
clifton
Figured it out after sometime.

>         DE.FindOrderByRef rsNew("orderID")
>
>         Debug.Print DE.rsFindOrderByRef.RecordCount
>
>         rsNew.MoveNext

Must close the recordset before opening it again. Thought I was
happening automatically.