This is too bizarre and I can't figure out why this is happening. I'm running the below code on a form. When this was first built and on a previous version of my database it worked just fine. I have made NO changes to the queries, tables or anything that was related to this form. Is there a reason why it's not working? I even went back to a backup of the previous version and it worked just fine... It's hanging up on the 'Set rs.=Currentdb'
Thanks for any help...
Note: In the previous version there was no ";" at the end of the StrSql code - I added it on the current version.
Thanks for any help...
Code:
Private Sub cbo_BCRT_Num_Click()
'recordset to grab calc'd database field from 10501_DecAnal_TotalSchLiab_Report_ALL query to populate form.
Dim strSql As String
Dim rs As dao.Recordset
Dim frm As Form
strSql = "SELECT sum(db_Tot_Sch_Liab) as sum1, " & _
"sum(db_Sch_DeDuped) as sum2, " & _
"sum(db_Net_Sch_Liab_Less_Dup) as sum3, " & _
"sum(db_Total_Damage_Claim) as sum4, " & _
"sum(db_Final_Acct_Adj_100) as sum5, " & _
"sum(db_POC_Total) as sum6, " & _
"sum(POC_EXP) as sum7, " & _
"sum(POC_WTH) as sum8, " & _
"sum(db_Net_POC) as sum9, " & _
"sum(POC_DeDuped) as sum10, " & _
"sum(POC_Count) as sum11 " & _
"FROM 10501_DecAnal_TotSchLiab_REPORT_ALL " & _
"WHERE BCRT_Creditor_Num = " & Me!cbo_BCRT_Num & ";"
Set rs = CurrentDb.OpenRecordset(strSql)
If (Not rs.BOF And Not rs.EOF) Then
Set frm = Forms![10502_DecisionAnalysis_frm]![10502_DecisionAnalysis_sfrm].Form
frm!txt_db_Total_Liab = Nz(rs.Fields("sum1"), 0)
frm!txt_db_DeDuped_Liab = Nz(rs.Fields("sum2"), 0)
frm!txt_db_Net_Liab = Nz(rs.Fields("sum3"), 0)
frm!txt_db_DamageClaim = Nz(rs.Fields("sum4"), 0)
frm!txt_fin_Acct_Adj_100 = Nz(rs.Fields("sum5"), 0)
frm!txt_db_POC_Tot_Claims = Nz(rs.Fields("sum6"), 0)
frm!txt_db_POC_Exp = Nz(rs.Fields("sum7"), 0)
frm!txt_db_POC_Wth = Nz(rs.Fields("sum8"), 0)
frm!txt_db_Net_Claim = Nz(rs.Fields("sum9"), 0)
frm!txt_db_POC_Dup = Nz(rs.Fields("sum10"), 0)
frm!txt_db_POC_Count = Nz(rs.Fields("sum11"), 0)
End If
rs.Close
Set rs = Nothing
Set frm = Nothing
Form.Refresh
End Sub
Note: In the previous version there was no ";" at the end of the StrSql code - I added it on the current version.