Movian
05-29-2009, 02:27 PM
I have a table, it has a single record in it (Although it can have more so i need the loop to search through it)
I have the following loop
Do Until PatRS.Fields("ReportPhys") = CStr(InterpPhysRs.Fields("InterpPhys")) Or InterpPhysRs.EOF
InterpPhysRs.MoveNext
Loop
Now as there is one record i would expect it to either match or atempt to go to the next record hit EOF and exit the loop.
In either case it should exit the loop
however instead i get a no current record error .... its really annoying as it appears this loop now works Sporadically at best.
Need to get this resolved ASAP
~Edit here is some more info to put this loop in prespective
Dim sTempList As String
Dim mydb As DAO.Database
Dim PatRS As DAO.Recordset, RefPhysRS As DAO.Recordset, LedgerRs As DAO.Recordset, InterpPhysRs As DAO.Recordset
Set mydb = CurrentDb()
Set PatRS = mydb.OpenRecordset("tblPatient")
Set RefPhysRS = mydb.OpenRecordset("tblPhys")
Set LedgerRs = mydb.OpenRecordset("Ledger")
Set InterpPhysRs = mydb.OpenRecordset("tblIntPhys")
sTempList = ""
'Find Correct Records in each recordset (exept the Ledger Table as this can contain multiple applicable records)
While Not PatRS.EOF And Not CStr(MedID) = CStr(PatRS.Fields("MedicalID#"))
PatRS.MoveNext
Wend
While Not RefPhysRS.EOF And Not PatRS.Fields("RefPhys") = CStr(RefPhysRS.Fields("Referring Phys"))
RefPhysRS.MoveNext
Wend
Do Until PatRS.Fields("ReportPhys") = CStr(InterpPhysRs.Fields("InterpPhys")) Or InterpPhysRs.EOF
InterpPhysRs.MoveNext
Loop
I have the following loop
Do Until PatRS.Fields("ReportPhys") = CStr(InterpPhysRs.Fields("InterpPhys")) Or InterpPhysRs.EOF
InterpPhysRs.MoveNext
Loop
Now as there is one record i would expect it to either match or atempt to go to the next record hit EOF and exit the loop.
In either case it should exit the loop
however instead i get a no current record error .... its really annoying as it appears this loop now works Sporadically at best.
Need to get this resolved ASAP
~Edit here is some more info to put this loop in prespective
Dim sTempList As String
Dim mydb As DAO.Database
Dim PatRS As DAO.Recordset, RefPhysRS As DAO.Recordset, LedgerRs As DAO.Recordset, InterpPhysRs As DAO.Recordset
Set mydb = CurrentDb()
Set PatRS = mydb.OpenRecordset("tblPatient")
Set RefPhysRS = mydb.OpenRecordset("tblPhys")
Set LedgerRs = mydb.OpenRecordset("Ledger")
Set InterpPhysRs = mydb.OpenRecordset("tblIntPhys")
sTempList = ""
'Find Correct Records in each recordset (exept the Ledger Table as this can contain multiple applicable records)
While Not PatRS.EOF And Not CStr(MedID) = CStr(PatRS.Fields("MedicalID#"))
PatRS.MoveNext
Wend
While Not RefPhysRS.EOF And Not PatRS.Fields("RefPhys") = CStr(RefPhysRS.Fields("Referring Phys"))
RefPhysRS.MoveNext
Wend
Do Until PatRS.Fields("ReportPhys") = CStr(InterpPhysRs.Fields("InterpPhys")) Or InterpPhysRs.EOF
InterpPhysRs.MoveNext
Loop