Hi friends,
Got stuck with the first loop not moving ahead...The function is executing fine ..but oce it returns to the originat recordset loop startsat the first record again...
plz help??
Got stuck with the first loop not moving ahead...The function is executing fine ..but oce it returns to the originat recordset loop startsat the first record again...
plz help??
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strtoid As String, strtnid As String
'strtoid = Me.txttoid
'strtnid = Form_TestSelectionUnboundB.TestName
Set db = CurrentDb
struser = GetUserName()
strreg = Me.RegistrationID
Set rstoid = db.OpenRecordset("SELECT BkOrdrTblID, BkDate, BkRegistrationID, BkPOG, BkDscnt,BkAmount,BkUser, BkRemarks, BkDept FROM BkOrdrTbl")
rstoid.AddNew
rstoid("BkRegistrationID").Value = strreg
rstoid("BkDate").Value = Now()
rstoid("BkPOG").Value = Me.cboPOG
rstoid("BkDscnt").Value = Nz(Me.txtDiscount, 0)
'TEMP=>>rstoid("BkUser").Value = Nz(struser, 0)
rstoid("BkRemarks").Value = Me.txtbkremarks
rstoid("BkDept").Value = Me.txtprefixid
'rstoid("BkAmnt").Value = Me.txtAmount
rstoid.Update
rstoid.Requery
rstoid.FindLast "BkRegistrationID=" & strreg & ""
strtoid = rstoid!BkOrdrTblID
rstoid.Close
'sqlnpt = ("SELECT BkOrdrTblID, TestName, TestCost, BookedTest FROM NonProfileTests")
'sqltmptbl = ("SELECT * FROM TmpTestSelectortbl")
strtid = strtoid
'----------?--------
Set rs = db.OpenRecordset("TmpTestSelectortbl")
With rs
Do Until rs.EOF
rs.MoveFirst
DoCmd.SetWarnings (WarningsOff)
DoCmd.RunSQL ("Insert into NonProfileTests (TestOrderID, TestName, TestCost, BookedTest) values (" & strtoid & ", ' " & rs("TestName") & " ','" & rs("TestCost") & "', -1 )")
strtnid = rs!TestName
Call SaveTestPro(strtnid, strtoid)
rs.MoveNext
Loop
End With
DoCmd.SetWarnings (WarningsOn)