Results 1 to 7 of 7

Thread: SQL Parameter Query - Rowset Position Cannot be Restarted

Threaded View

  1. #1

    Thread Starter
    Fanatic Member The_Grudge's Avatar
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    836

    SQL Parameter Query - Rowset Position Cannot be Restarted

    I have the following code:

    It works in that my query executes and if I remove the .MoveFirst statement (bold below), but I need that statement in there as my records are sorted in order and I refer to it throughout the program.

    This is the first time I open the recordset and when it gets to that .movefirst statement below I get

    "An Error Has Occurred - Rowset position cannot be restarted"

    Any idears? I notice using a debug.print that it's not setting the cursor type/location to what I specify

    Code:
    strSQL = "My QUERY GOES HERE"
                     
     Dim objCommand As ADODB.Command
     Set objCommand = New ADODB.Command
     
     With objCommand
       .ActiveConnection = SQLCon
       .CommandType = adCmdText
       .CommandText = strSQL
       .Prepared = True
       .Parameters.Append .CreateParameter("ClinicDate", adDate, adParamInput, , dtDate)
       .Parameters.Append .CreateParameter("Institution", adChar, adParamInput, 4, strInstitution)
          
    
      rsGetTodaysData.CursorType = adOpenDynamic
      Set rsGetTodaysData = objCommand.Execute
      Set objCommand = Nothing
    
    End With
     
    With rsGetTodaysData
       If .BOF <> True And .EOF <> True Then
          .MoveFirst
             Do Until .EOF = True
                If FormInUse.Name = "frmMain" Then
    Last edited by The_Grudge; May 25th, 2018 at 01:32 PM.

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