I had to go ahead and just write it in VB:
Code:
If srStyle = "78294" Then
rs.Open "Select * from [" & TableName & "] WHERE [Temp]=0 AND RIGHT([Rep], 5)='Total' AND LEFT([Rep], 5)<>'Grand'", CurrentProject.Connection, adOpenDynamic, adLockPessimistic
While Not rs.EOF
rs("Rep ID") = DLookup("[Rep ID]", "[" & TableName & "]", "[Rep]='" & Left(rs!REP, Len(rs!REP) - 6) & "' AND [Temp]=0")
rs.MoveNext
Wend
rs.Close
End If
I'd obviously much rather have the above executing server-side (with my server's monster procs) via SQL than client-side via VB, but the VB had to do as a stopgap. I am testing swampBoogie's SQL code right now and if it works, I will definitely go with that instead.
Bookmarks