Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

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 20th, 2003, 10:27 AM
Jigsatics Jigsatics is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 23 Jigsatics User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Jigsatics
type mismatch error

Quote:
Const dbsLoc As String = "I:\A1136\"
Dim dbsTES As Database
Dim rstFound As Recordset
Dim OldSearchText As String

Option Compare Database
Option Explicit


Private Sub Form_Load()
Set dbsTES = OpenDatabase(dbsLoc & "97NFO.mdb")
MsgBox "loading program"
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set dbsTES = Nothing
Set rstFound = Nothing
End Sub

Private Sub cmdFind_Click()
Dim sqlStatement As String

txtSearchID.SetFocus

If txtSearchID.Text <> OldSearchText Then
Set rstFound = Nothing
OldSearchText = txtSearchID.Text
Else
Exit Sub
End If

If txtSearchID.Text = "" Then
Exit Sub
End If


sqlStatement = "SELECT * FROM tblGeneralSection WHERE tblGeneralSection.SiteID = 2"

Set rstFound = dbsTES.OpenRecordset(sqlStatement)
--snipped--


What is wrong with my code? I'm getting a type mismatch error on the last line "Set rstFound = dbsTES.OpenRecordset(sqlStatement)"

tblgeneralsection.siteid is numeric. and im running access 97.

Reply With Quote
  #2  
Old November 21st, 2003, 01:38 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
I can't find any problems with your code, espically since you stated siteid is a number. Is there a chance that you are setting dbsTES to nothng somwhere else in your code.

S-

Reply With Quote
  #3  
Old November 21st, 2003, 04:11 PM
Jigsatics Jigsatics is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 23 Jigsatics User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Jigsatics
Only in the unload event. Nowhere else.

Reply With Quote
  #4  
Old November 23rd, 2003, 04:54 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Now is ths your real SQl Statement

sqlStatement = "SELECT * FROM tblGeneralSection WHERE tblGeneralSection.SiteID = 2"

OR is this it

sqlStatement = "SELECT * FROM tblGeneralSection WHERE tblGeneralSection.SiteID = txtSearchID.Text"


"txtSearchID.Text" says I'm a text value Not numeric.

If this is the case use

txtSearchID

S-

Reply With Quote
  #5  
Old November 26th, 2003, 11:10 PM
cgates cgates is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: CA
Posts: 1 cgates User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
type mismatch error

Change Dim rstFound As Recordset
To Dim rstFound As DAO.Recordset

and try it again.

CG

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > type mismatch error


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 1 hosted by Hostway