Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3061 1

Status
Not open for further replies.

cariengon

Technical User
Mar 18, 2002
283
US
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...

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.

 
Hi as you have started again in a new database you need to check your references. New databases start out using references for ADO not DAO so you need to remove the ADO reference and add 'Microsoft DAO 3.6 Object Library'.

Hope that helps
Sim

----------------------------------------
My doctor says that I have a malformed public duty gland and a natural deficiency in moral fibre and that I'm therefore excused from saving universes.
----------------------------------------
 
I do have DAO referenced and there is no reference for ADO - only ActiveX. I removed this reference and it still didn't work. I have the following referenced:

Visual Basic for Applications
Microsoft Access 10.0 Object Library
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.7 Library

Like I said, I removed the ActiveX and tried it and still got the same error...
 
I don't see anything wrong with the code, so I would try this...
1. Put a break point in the code on the Set rs = CurrentDb.OpenRecordset(strSql) line.
2. Open the Immediate window and enter ?strSQL
3. Copy the result into a new query.
4. Attempt to run the query. This may show you where your error is.


Randy
 
Just a guess, maybe one of the references is different? possibly a typo in a form/table/field name, or some different organization? A changed/different reference, or object you are trying to reference would be my first guess.

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Thank you Randy!!

Using the immediate window narrowed down where I was having the problem. I forgot that I changed the name of a field... It's a pretty complex query and it didn't jump out at me!

Problem Solved!!
Carie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top