Newbie needs help with database front end 
Author Message
 Newbie needs help with database front end

Numbers are not delimited by single quotes in SQL. Remove the single quotes
before and after txtDesc and you should be OK. Just make sure there really
is a number in txtDesc.

Quote:
> Someone Please Help !!!!!,
> I am writing a database front end for a Access backend.
> I am using the data control with VB6( so I guess I am using ADO?)
> My Access database has a field called On Hand that holds a Number data
> type( it is formatted that way in the database).
> On my front end if I do a search like:

> SearchSql = "SELECT * FROM TotalNutritionInv WHERE [On Hand] = '" & _
>                       txtDesc & " ' "

> If (Len(SearchSql) > 0) Then
>      datInventory.RecordSource = SearchSql
>      datInventory.Refresh
>  End If

> SearchSql is a string variable

> I get a run time error 3464 Data Type mismatch in criteria expression

> But if I change the data type in the Access database to TEXT
> everything works fine.

> Can someone please tell me why this is happening?
> I would like to keep the data type as NUMBER if possible.

>                               PLEASE HELP



Thu, 21 Feb 2002 03:00:00 GMT  
 Newbie needs help with database front end
Someone Please Help !!!!!,
I am writing a database front end for a Access backend.
I am using the data control with VB6( so I guess I am using ADO?)
My Access database has a field called On Hand that holds a Number data
type( it is formatted that way in the database).
On my front end if I do a search like:

SearchSql = "SELECT * FROM TotalNutritionInv WHERE [On Hand] = '" & _
                      txtDesc & " ' "

If (Len(SearchSql) > 0) Then
     datInventory.RecordSource = SearchSql
     datInventory.Refresh
 End If

SearchSql is a string variable

I get a run time error 3464 Data Type mismatch in criteria expression

But if I change the data type in the Access database to TEXT
everything works fine.

Can someone please tell me why this is happening?
I would like to keep the data type as NUMBER if possible.

                              PLEASE HELP



Fri, 22 Feb 2002 03:00:00 GMT  
 Newbie needs help with database front end
Remove the single quote,
SearchSql = "SELECT * FROM TotalNutritionInv WHERE [On Hand] = " &
txtDesc
If On Hand is numeric you don't need the quotes
If you change the field in Access to string YOU NEED QUOTES that's why
it worked

Quote:

> Someone Please Help !!!!!,
> I am writing a database front end for a Access backend.
> I am using the data control with VB6( so I guess I am using ADO?)
> My Access database has a field called On Hand that holds a Number data
> type( it is formatted that way in the database).
> On my front end if I do a search like:

> SearchSql = "SELECT * FROM TotalNutritionInv WHERE [On Hand] = '" & _
>                       txtDesc & " ' "

> If (Len(SearchSql) > 0) Then
>      datInventory.RecordSource = SearchSql
>      datInventory.Refresh
>  End If

> SearchSql is a string variable

> I get a run time error 3464 Data Type mismatch in criteria expression

> But if I change the data type in the Access database to TEXT
> everything works fine.

> Can someone please tell me why this is happening?
> I would like to keep the data type as NUMBER if possible.

>                               PLEASE HELP

--
Humberto Gonzalez

My personal page: http://www.geocities.com/SiliconValley/Park/5117
Business Page: http://www.interven.net/acron


Sat, 23 Feb 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help - using VB as front end for Access Database

2. Help with Vb front end for access database

3. need help updating a local front end mdb from an mdb on an ftp site

4. Newbie question: improve VB front-end app response time

5. Newbie: Why use Access instead of VB to create front end

6. Newbie: VB6 front-end to oracle8i problems

7. Trying to backup a database from front end w/ FileCopy

8. Corruption of Database Front End

9. Access database corruption using vb front ends

10. Database Front End Sample

11. Database Front End

12. Visual Basic Front Ends For Access Databases

 

 
Powered by phpBB® Forum Software