Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 22nd, 2004, 06:22 PM
OrangePunter OrangePunter is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 OrangePunter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Run Time Error 80040e37

Hi! I am fairly new to VB coding and am trying to create an ODBC connection and am getting a run time error (80040e37). Does anyone have any remedies? Below is the coding that I have... The purpose of it is to auto-populate the Advertiser field based on the contract id that is entered to avoid misspellings and furthers errors that could inhibit later analysis.


Dim db As adodb.Connection
Dim rs As adodb.Recordset
Dim sql As String
Dim Contractid As Long
Set db = New adodb.Connection
db.ConnectionString = "Driver={SYBASE ASE ODBC Driver};" & _
"Srvr=ADS_2;" & _
"Uid=orangepunter;" & _
"Pwd=adri6;" & _
"Database=ams;"
db.Open
Contractid = txtContractID.Text
sql = "SELECT dbo_tblAdvertisers.Advertiser"
sql = sql & " FROM dbo_tblContract INNER JOIN dbo_tblAdvertisers ON dbo_tblContract.AdvertiserID = dbo_tblAdvertisers.AdvertiserID"
sql = sql & " where contractnumber = " & Contractid

Set rs = New adodb.Recordset
rs.CursorLocation = adUseClient
rs.Open sql, db, adOpenForwardOnly, adLockReadOnly
txtAdvertiser.Text = rs.Fields("Advertiser")

thanks for your help!

Reply With Quote
  #2  
Old November 22nd, 2004, 08:05 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
What is the complete error text? In IE make sure "show friendly http errors" is not set. What line causes your error? Are you sure your connection string is right? Is the ODBC driver installed on the web server? (I have no clue with Sybase ODBC).
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old November 23rd, 2004, 11:32 AM
OrangePunter OrangePunter is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 OrangePunter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by Doug G
What is the complete error text? In IE make sure "show friendly http errors" is not set. What line causes your error? Are you sure your connection string is right? Is the ODBC driver installed on the web server? (I have no clue with Sybase ODBC).

Hi Doug! Thanks for taking a minute with this one. The error message is below:

Run-time error '-2147217865(80040e37)' [Merant][ODBC Sybase driver][sql server]dbo_tblcontract not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).

This program is a stand alone VB product, not web based. The rs.open line is where I am getting the error. The connection is correct in terms of spelling and works through access.

Let me know what you think! Thanks again

Reply With Quote
  #4  
Old November 23rd, 2004, 01:46 PM
OrangePunter OrangePunter is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 OrangePunter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Fixed :)

NM....I got it. I just rewrote the SQL (excluding INNER JOIN) and fixed the variable Contract ID and it is working now. Not sure why it wasn't working before . Later

Reply With Quote
  #5  
Old July 6th, 2005, 11:38 PM
lvchang lvchang is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 4 lvchang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 32 sec
Reputation Power: 0
Same here too!

I also have thris problem please solve it for me:

error:
Runtime error '2147217865 (80040e37)' :

"The microsoft Jet database engine cannot find the input table or query 'Products'. Make Sure it exists and that its name is spelled correctly"


part of my Coding:

Private Sub Form_Load()
'open database and table
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs5 = New ADODB.Recordset
Set rs6 = New ADODB.Recordset
Set stors = New ADODB.Recordset


cs = "Provider=Microsoft.Jet.OLEDB.4.0;"
cs = cs & "Data Source=Projectdatabase.mdb;"

conn.Open cs
rs.Open "Products", cs, adOpenDynamic, adLockOptimistic, adCmdTable (debug area!

rs.MoveFirst
Combo1 = rs.Fields("pcode")
Combo2 = rs.Fields("product_category")
Text1.Text = rs.Fields("number")
Text2.Text = rs.Fields("typecode")
Text3.Text = rs.Fields("description")
Text4.Text = rs.Fields("cost")

progrid.Refresh
Set progrid.DataSource = rs

rs.MoveFirst
Do While Not rs.EOF
Combo1.AddItem rs.Fields("pcode")
rs.MoveNext
Loop


rs.MoveFirst
Do While Not rs.EOF
Combo2.AddItem rs6.Fields("product_category")
rs6.MoveNext
Loop


When I debug, it went here:

rs.Open "Products", cs, adOpenDynamic, adLockOptimistic, adCmdTable

Reply With Quote
  #6  
Old July 7th, 2005, 07:51 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
Quote:
"The microsoft Jet database engine cannot find the input table or query 'Products'. Make Sure it exists and that its name is spelled correctly"

Doesn't this error tell you what is wrong?

You could try putting [ ] around the table name in case Products is a reserved word.

Reply With Quote
  #7  
Old July 8th, 2005, 02:01 AM
lvchang lvchang is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 4 lvchang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 32 sec
Reputation Power: 0
ok I got it

ok I got it, but there is still another error!

error:

Runtime error '2147217865 (80040e37)' :
Syntax error(missing operator) in query expression 'product.pcode=stock category.pcodewhere product_category like '&%".

and the code is:

Private Sub Command11_Click()

Set rs2 = New ADODB.Recordset
Dim vsql2 As String
vsql2 = "select product.pcode,number,typecode,description,cost,pro duct_category from product ,stock_category "
vsql2 = vsql2 & " where product.pcode = stock_category.pcode"
vsql2 = vsql2 & "where product_category like '" & Trim(Text5.Text) & "%' "

rs2.Open vsql2, conn, adOpenDynamic, adLockOptimistic, adCmdText (debug area)
Set progrid.DataSource = rs2
progrid.Refresh

progrid.Refresh
rs2.MoveFirst

End Sub

I'm doing a searching using joints because I want to retrieve data from two different table!

Reply With Quote
  #8  
Old July 29th, 2005, 01:39 AM
lvchang lvchang is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 4 lvchang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 32 sec
Reputation Power: 0
ok this is the last one can you help me

Run Time Error 80040e37

Syntax error (missing operator) in query expression 'typecode like '306%' and description = Trim (text5.text)'

Codes

Private Sub Combo2_Click()

Set rs3 = New ADODB.Recordset
Dim vsql2 As String
vsql2 = "select typecode,description from [product] "
vsql2 = vsql2 & " where typecode like '" & Trim(Combo2.Text) & "%' "
vsql2 = vsql2 & " and description = Trim(text5.text) & "

rs3.Open vsql2, conn, adOpenDynamic, adLockOptimistic, adCmdText

rs3.MoveFirst

End Sub

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Run Time Error 80040e37


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT