No Records Found ERROR---HELP!!!

K

khanner

Never used to get this error msg till now. I suck t VBA any help PLEASE!!!


Public Function ArchiveResults()
Dim historical As DAO.Recordset
Set historical = CurrentDb.OpenRecordset("Tbl_HistoricalResults",
dbOpenDynaset)
Dim results As DAO.Recordset
Set results = CurrentDb.OpenRecordset("Tbl_Results", dbOpenDynaset)



historical.AddNew
historical("Run_Time").Value = results("Run_Time").Value
historical("CUSIP").Value = results("CUSIP").Value
historical("Group_Deal_Collateral").Value =
results("Group_Deal_Collateral").Value
historical("UPSIDE_FACTOR").Value = results("UPSIDE_FACTOR").Value
historical("DOWNSIDE_FACTOR").Value = results("DOWNSIDE_FACTOR").Value
historical("WA_Curr_LTV").Value = results("WA_Curr_LTV").Value
historical("WA_Trough_LTV").Value = results("WA_Trough_LTV").Value
historical("WA_Final_LTV").Value = results("WA_Final_LTV").Value
historical("WA_Peak2Trough").Value = results("WA_Peak2Trough").Value
historical("WA_Current2Trough").Value = results("WA_Current2Trough").Value
'Current loans
historical("NumLoans").Value = results("NumLoans").Value
historical("ValueLoans").Value = results("ValueLoans").Value
historical("CollatValue").Value = results("CollatValue").Value
historical("PctofPool").Value = results("PctofPool").Value
historical("AvgLTV").Value = results("AvgLTV").Value
historical("AvgSize").Value = results("AvgSize").Value
historical("ImplSev").Value = results("ImplSev").Value
'Delinquent loans
historical("DQNumLoans").Value = results("DQNumLoans").Value
historical("DQValueLoans").Value = results("DQValueLoans").Value
historical("DQCollatValue").Value = results("DQCollatValue").Value
historical("DQPctofPool").Value = results("DQPctofPool").Value
historical("DQAvgLTV").Value = results("DQAvgLTV").Value
historical("DQAvgSize").Value = results("DQAvgSize").Value
historical("DQImplSev").Value = results("DQImplSev").Value
historical("EstimatedLoss").Value = results("EstimatedLoss").Value
historical.Update

End Function
 
D

Duane Hookom

I would try add a line of code to move to the first record in results.
If Not (Results.BOF and Results.EOF) Then
Results.MoveFirst
'code here to add the record
Have you considered an append query?
Dim strSQL As String
strSQL = "INSERT INTO Tbl_HistoricalResults (... field list ....) SELECT
....field list... FORM tbl_Results;"
CurrentDb.Execute strSQL, dbFailOnError
 
K

khanner

Sorry not sure what you mean, can you possible write the cide and where
should i insert it?
 
K

khanner

also can I email you directly if you dont mind

khanner said:
Sorry not sure what you mean, can you possible write the cide and where
should i insert it?
 
D

Duane Hookom

I gave you the lines of code an suggested where to add them.

The strSQL would replace all of your code that adds a new record.

I would prefer to keep all discussions in the public news group as long as
possible.
 

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