I phased this out

G

George Hester

http://msdn.microsoft.com/library/en-us/dnvbpj00/html/sqladoisting.asp?frame=true

and I was able to get my project back on track. It turns out that I do not like the way Access 2002 sorts text records. It requires way too much work to check that the result of the project is behaving as it should.

So I have something like this:

If strFldName2 <> "strLocation" Then
dB.Execute strSQL, dbFailOnError
Else
dB.Execute strSQLOld, dbFailOnError
End If
acc.DBEngine.Idle dbRefreshCache
Set RsQry = ExecuteSQL(strSortHyphens, strDbName).Clone

and this ExecuteSQL is have you have seen in the above link. The only difference is that I am making an ADOR.Recordset not a ADODB.Recordset.

strSortHyphens is a SELECT query which delivers all Text entries that contain a hyphen -. RsQry should be a ADOR.Recordset upon return of the function ExecuteSQL.

But this is failing. Here is the pertinent part in ExecuteSQL:

MsgBox "In here(modExecuteSQL)?"
Set rst = New ADOR.Recordset

With rst
.ActiveConnection = cnn
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockBatchOptimistic
.Open Trim$(SQL)
End With
MsgBox "In modSQLExecute: Recordcount = " & rst.RecordCount

If I comment out the above MsgBox, MsgBox "In here(modExecuteSQL)?" this routine fails. If I uncomment the above MsgBox, MsgBox "In here(modExecuteSQL)?" it succeeds. Each and every time.

It seems that there is interfernce with the ability of the active connection connecting unless I halt the procedure manually as is done with the MsgBox. Is there some way that I can test to see if the Active Connection can connect without user intervention and if not tell it to twiddle its thumbs until it can connect?

I just don't understand how inserting a MsgBox can determine whether an application fails or not. No wonder I scraped this function a while back.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top