Solved

DATABASE DATA TYPES

Posted on 1998-10-28
2
125 Views
Last Modified: 2010-04-30
in vb5, using a database i created in access 97, i am having
trouble with data types when i use the refresh command.
Basically, in vb5 i've defined a integer variable (a%), assigned it a number, (a=4),
Now, i have a field in a access database with the data type 'number' containing only whole numbers
When i use, in vb5, an SQL to search the database using the variable 'a' (insted of putting a number in)
ie SELECT * FROM table WHERE field1 = '" & a & "'"
the use a refresh command, it comes up with a data type error

If i change the field data type in access to be 'text' it works but i don't want to, or if i change
the SQL to field=2 it works but whats wrong with how i want to do it.
 
0
Comment
Question by:SIMONBRATT
2 Comments
 
LVL 14

Accepted Solution

by:
waty earned 50 total points
ID: 1442044
Your query is not correct :

SELECT * FROM table WHERE field1 = " & a

The ' between the value indicates that it is for string.
0
 

Author Comment

by:SIMONBRATT
ID: 1442045
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now