Run-time error '-2147217865(80040e37)':
- From: "Anna" <colleen1980@xxxxxxxxx>
- Date: 13 Feb 2007 10:44:38 -0800
Hi: When i try to execute the query it gives syntax error that
Run-time error '-2147217865(80040e37)':
Table or view not found: Table 'user_view' not found
But if i copy the same query and run into the database it works fine
no error. I dont know why it gives error when i try to execute the
query within the VB code. It gives error when condition is true
"frmUserDistribution.chkInterOffice.Value = 1"
Set rsADODM = cnADODM.Execute(SQL)
-----------------------------------------------------------------
If frmUserDistribution.chkInterOffice.Value = 1 Then
SQL = "set temporary option user_estimates='enabled'; " & _
"select distinct(dbtr_view.debtor_id),
dbtr_view.Next_Contact_Date,debt.clt_id, clt_ref_no, name1, name2,
list_date, cur_bal, assign_id, dbtr_view.status_code,
dbtr_view.status_date, dbtr_view.next_contact_date " & _
"From dm.dbtr_view " & _
"left outer join dm.debt on (debt.debt_id =
dbtr_view.debtor_id,0) " & _
"inner join user_view on user_view.user_id =
dbtr_view.assign_id " & _
"left outer join dm.pmt on (dbtr_view.debtor_id =
pmt.debtor_id,0) where "
Else
SQL = "set temporary option user_estimates='enabled'; " & _
"select distinct(dbtr_view.debtor_id),
dbtr_view.Next_Contact_Date,debt.clt_id, clt_ref_no, name1, name2,
list_date, cur_bal, assign_id, dbtr_view.status_code,
dbtr_view.status_date, dbtr_view.next_contact_date " & _
"From dm.dbtr_view " & _
"left outer join dm.debt on (debt.debt_id =
dbtr_view.debtor_id,0) " & _
"left outer join dm.pmt on (dbtr_view.debtor_id =
pmt.debtor_id,0) where "
End If
SQL = SQL & "dbtr_view.assign_id in ('" & Left$(AssignID, 3) & "'"
SQL = StringToSQL(SQL, AssignID)
'Adjust day to query accounts that have not had a payment since
then
If NoOfDaysPMT <> -1 Then
pmtDate = Format(DateAdd("d", -NoOfDaysPMT, Date), "yyyy-
mm-dd")
'no payment has been made for atleast noOfDaysPmt
SQL = SQL & " and pmt_date < '" & pmtDate & "' "
End If
'Adjust list date accordingly
If lstdateFrom <> -1 Then
ldateFrom = Format$(lstdateFrom, "yyyy-mm-dd")
ldateTo = Format$(lstdateTo, "yyyy-mm-dd")
SQL = SQL & " and list_date between '" & ldateFrom & "'
and '" & ldateTo & "' "
End If
'Only return accounts with legit phone numbers
If GoodPhones Then
'returns accounts with valid phone numbers
SQL = SQL & " and active_phone1 not in
('0000000000','1111111111','2222222222','33333333333','4444444444','5555555555','6666666666','7777777777','8888888888','9999999999')
and " _
& "active_phone1 between '0000000000' and '9999999999'
"
End If
'specifiy client id
If ClientID(1) <> -1 Then
If cltIDNotIn = False Then
SQL = SQL & " and (debt.clt_id like '" & ClientID(1) & "'
"
i = 2
Do While i <= ClientID.Count
SQL = SQL & " or debt.clt_id like '" & ClientID(i) &
"' "
i = i + 1
Loop
SQL = SQL & ") "
Else
SQL = SQL & " and (debt.clt_id not like '" & ClientID(1) &
"' "
i = 2
Do While i <= ClientID.Count
SQL = SQL & " and debt.clt_id not like '" &
ClientID(i) & "' "
i = i + 1
Loop
SQL = SQL & ") "
End If
End If
'Specify balance range of accounts to return
If BalanceRange_Lower <> -1 Then
'checks for upper bound
If BalanceRange_Upper <> -2 Then
SQL = SQL & " and cur_bal between " &
BalanceRange_Lower & " and " & BalanceRange_Upper
Else
SQL = SQL & " and cur_bal > " & BalanceRange_Lower
End If
End If
'Specify status codes of accounts to return
If StatusCodes <> "none" Then
If StatCodesNotIn = False Then
SQL = SQL & " and dbtr_view.status_code in ('" & _
Left$(StatusCodes, 3) & "'"
SQL = StringToSQL(SQL, StatusCodes)
Else
SQL = SQL & " and dbtr_view.status_code not in ('" & _
Left$(StatusCodes, 3) & "'"
SQL = StringToSQL(SQL, StatusCodes)
SQL = SQL & " and dbtr_view.status_code < '400' "
End If
Else
'if no status code specified - be sure only open accounts are
returned
SQL = SQL & " and dbtr_view.status_code < '400' "
End If
Debug.Print SQL
cnADODM = OpenDatabaseConnection(Debtmaster_ReadOnlyConnection)
cnADODM.Open
'Query dbtr_view, pmt, debt tables based on criteria
Debug.Print SQL
Set rsADODM = cnADODM.Execute(SQL)
.
- Follow-Ups:
- Re: Run-time error '-2147217865(80040e37)':
- From: Steve Easton
- Re: Run-time error '-2147217865(80040e37)':
- Prev by Date: Dynamic Arrays in UDTs?
- Next by Date: Re: How to pass an array of string in VB to a C DLL that expects a cha
- Previous by thread: Dynamic Arrays in UDTs?
- Next by thread: Re: Run-time error '-2147217865(80040e37)':
- Index(es):
Relevant Pages
|