Solved

DATABASE DATA TYPES

Posted on 1998-10-28
2
124 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

12 Experts available now in Live!

Get 1:1 Help Now