Results 1 to 2 of 2

Thread: Proper commands for updating recordset created using SQL command from Data Environmen

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Posts
    1

    Proper commands for updating recordset created using SQL command from Data Environmen

    I am unable to open the recordset created using SQL command from Data Environment Designer in VB6. I can see the table that gets created within Access but I cannot use the command MoveFirst to read the recordset sequentially to update the records selectively. Move First command generates the Run-time error ‘3704’: Operation is not allowed when the object is closed. Here is the outline of my code
    vb Code:
    1. Private Sub cmdProcess_Click()
    2.  
    3. Dim de1 As denCovcalc
    4. Dim rst2 As Recordset
    5.  
    6. Set de1 = Nothing
    7. Set rst3 = Nothing
    8.  
    9. Set de1 = denCovcalc
    10.  
    11. If de1.rscomCovactual.State = 1 Then
    12.   de1.rscomCovactual.Close
    13. End If
    14.  
    15. de1.comCovactual
    16.  
    17. Set rst3 = de1.rscomCovactual
    18.  
    19. rst3.MoveFirst
    If I try to insert the following command to open the recordset before rst3.MoveFirst command
    vb Code:
    1. If de1.rscomCovactual.State = 0 Then
    2.   de1.rscomCovactual.Open
    3. End If
    I get the error message that object is already open

    Thanks!
    Attached Images Attached Images  

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    Re: Proper commands for updating recordset created using SQL command from Data Environmen

    You really should not use a data environment for what your trying to do. An ADO Recordset would work much better. If you don't know how to use ADO then there are tutorials on this site. ADO Tutorial
    There are also lots and lots of posts on the subject.

    Good Luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width