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




Reply With Quote