473,651 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access queries/ Search criteria

I am using a Access Database to search/add a bunch of information in
MS VB.net 2005 express. In the query (querybuilder) everything seems
right, but in the WHERE statement I use [Number] = me.textbox.text .

Then in the statement I have an if statement

IF combobox.text = option1 Then
e.databaseadapt er.GetDataBy2() 'which is the query i built
end if

I get an error each time, and can't figure out if it is with the sql
statement, or the execution. Is there a search critria field i need
to put in place of me.textbox.text ?

Apr 18 '07 #1
11 2269
On 18 Apr 2007 05:17:50 -0700, Ri*****@gmail.c om wrote:

¤ I am using a Access Database to search/add a bunch of information in
¤ MS VB.net 2005 express. In the query (querybuilder) everything seems
¤ right, but in the WHERE statement I use [Number] = me.textbox.text .
¤
¤ Then in the statement I have an if statement
¤
¤ IF combobox.text = option1 Then
¤ e.databaseadapt er.GetDataBy2() 'which is the query i built
¤ end if
¤
¤ I get an error each time, and can't figure out if it is with the sql
¤ statement, or the execution. Is there a search critria field i need
¤ to put in place of me.textbox.text ?

What is the error that is being generated? BTW, Number is a Jet reserved word so it may not be a
good choice for a column name.
Paul
~~~~
Microsoft MVP (Visual Basic)
Apr 18 '07 #2
On Apr 18, 9:59 am, Paul Clement
<UseAdddressAtE ndofMess...@sws pectrum.comwrot e:
On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.c om wrote:

¤ I am using a Access Database to search/add a bunch of information in
¤ MS VB.net 2005 express. In the query (querybuilder) everything seems
¤ right, but in the WHERE statement I use [Number] = me.textbox.text .
¤
¤ Then in the statement I have an if statement
¤
¤ IF combobox.text = option1 Then
¤ e.databaseadapt er.GetDataBy2() 'which is the query i built
¤ end if
¤
¤ I get an error each time, and can't figure out if it is with the sql
¤ statement, or the execution. Is there a search critria field i need
¤ to put in place of me.textbox.text ?

What is the error that is being generated? BTW, Number is a Jet reserved word so it may not be a
good choice for a column name.

Paul
~~~~
Microsoft MVP (Visual Basic)
This is basicly the error I get.

http://img107.imageshack.us/img107/8965/vbcn6.jpg

Apr 18 '07 #3
On Apr 18, 1:34 pm, Riva...@gmail.c om wrote:
On Apr 18, 9:59 am, Paul Clement

<UseAdddressAtE ndofMess...@sws pectrum.comwrot e:
On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.c om wrote:
¤ I am using a Access Database to search/add a bunch of information in
¤ MS VB.net 2005 express. In the query (querybuilder) everything seems
¤ right, but in the WHERE statement I use [Number] = me.textbox.text .
¤
¤ Then in the statement I have an if statement
¤
¤ IF combobox.text = option1 Then
¤ e.databaseadapt er.GetDataBy2() 'which is the query i built
¤ end if
¤
¤ I get an error each time, and can't figure out if it is with the sql
¤ statement, or the execution. Is there a search critria field i need
¤ to put in place of me.textbox.text ?
What is the error that is being generated? BTW, Number is a Jet reserved word so it may not be a
good choice for a column name.
Paul
~~~~
Microsoft MVP (Visual Basic)

This is basicly the error I get.

http://img107.imageshack.us/img107/8965/vbcn6.jpg- Hide quoted text -

- Show quoted text -
Any Ideas?

Apr 19 '07 #4
On 19 Apr 2007 05:14:37 -0700, Ri*****@gmail.c om wrote:

¤ On Apr 18, 1:34 pm, Riva...@gmail.c om wrote:
¤ On Apr 18, 9:59 am, Paul Clement
¤ >
¤ >
¤ >
¤ >
¤ >
¤ <UseAdddressAtE ndofMess...@sws pectrum.comwrot e:
¤ On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.c om wrote:
¤ >
¤ ¤ I am using a Access Database to search/add a bunch of information in
¤ ¤ MS VB.net 2005 express. In the query (querybuilder) everything seems
¤ ¤ right, but in the WHERE statement I use [Number] = me.textbox.text .
¤ ¤
¤ ¤ Then in the statement I have an if statement
¤ ¤
¤ ¤ IF combobox.text = option1 Then
¤ ¤ e.databaseadapt er.GetDataBy2() 'which is the query i built
¤ ¤ end if
¤ ¤
¤ ¤ I get an error each time, and can't figure out if it is with the sql
¤ ¤ statement, or the execution. Is there a search critria field i need
¤ ¤ to put in place of me.textbox.text ?
¤ >
¤ What is the error that is being generated? BTW, Number is a Jet reserved word so it may not be a
¤ good choice for a column name.
¤ >
¤ Paul
¤ ~~~~
¤ Microsoft MVP (Visual Basic)
¤ >
¤ This is basicly the error I get.
¤ >
¤ http://img107.imageshack.us/img107/8965/vbcn6.jpg- Hide quoted text -
¤ >
¤ - Show quoted text -
¤
¤ Any Ideas?

Yes, the error indicates that one of the column names or criteria is not being recognized. I didn't
see your complete statement but it should look something like the following (assuming Number is a
numeric field):

"WHERE [Number] = " & me.textbox.text

In your example, me.textbox.text will not be evaluated until it is sent to the database engine
(which will have no clue as to what it is).
Paul
~~~~
Microsoft MVP (Visual Basic)
Apr 19 '07 #5
On Apr 19, 10:23 am, Paul Clement
<UseAdddressAtE ndofMess...@sws pectrum.comwrot e:
On 19 Apr 2007 05:14:37 -0700, Riva...@gmail.c om wrote:

¤ On Apr 18, 1:34 pm, Riva...@gmail.c om wrote:
¤ On Apr 18, 9:59 am, Paul Clement
¤ >
¤ >
¤ >
¤ >
¤ >¤ <UseAdddressAtE ndofMess...@sws pectrum.comwrot e:

¤ On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.c om wrote:
¤ >
¤ ¤ I am using a Access Database to search/add a bunch of information in
¤ ¤ MS VB.net 2005 express. In the query (querybuilder) everything seems
¤ ¤ right, but in the WHERE statement I use [Number] = me.textbox.text .
¤ ¤
¤ ¤ Then in the statement I have an if statement
¤ ¤
¤ ¤ IF combobox.text = option1 Then
¤ ¤ e.databaseadapt er.GetDataBy2() 'which is the query i built
¤ ¤ end if
¤ ¤
¤ ¤ I get an error each time, and can't figure out if it is with the sql
¤ ¤ statement, or the execution. Is there a search critria fieldi need
¤ ¤ to put in place of me.textbox.text ?
¤ >
¤ What is the error that is being generated? BTW, Number is a Jet reserved word so it may not be a
¤ good choice for a column name.
¤ >
¤ Paul
¤ ~~~~
¤ Microsoft MVP (Visual Basic)
¤ >
¤ This is basicly the error I get.
¤ >
¤ >http://img107.imageshack.us/img107/8965/vbcn6.jpg-Hide quoted text -
¤ >
¤ - Show quoted text -
¤
¤ Any Ideas?

Yes, the error indicates that one of the column names or criteria is not being recognized. I didn't
see your complete statement but it should look something like the following (assuming Number is a
numeric field):

"WHERE [Number] = " & me.textbox.text

In your example, me.textbox.text will not be evaluated until it is sent to the database engine
(which will have no clue as to what it is).

Paul
~~~~
Microsoft MVP (Visual Basic)
SELECT [Asset Tag Number], [User], Username, [Department Name],
[Asset Name], [Asset Type], Catergory, [Serial Number], [Purchase
Order Number],
[Purchase Price], [Purchase Date], Warrenty,
Notes
FROM PPC_Inventory
WHERE '[Asset Tag Number] =' & me.ToolStripTex tBox1.[text]
ORDER BY [Asset Tag Number]

is my query, in query builder. No luck still. any help?

Apr 20 '07 #6
On 20 Apr 2007 07:22:37 -0700, Ri*****@gmail.c om wrote:

¤ ¤ On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.c om wrote:
¤ ¤ >
¤ ¤ ¤ I am using a Access Database to search/add a bunch of information in
¤ ¤ ¤ MS VB.net 2005 express. In the query (querybuilder) everything seems
¤ ¤ ¤ right, but in the WHERE statement I use [Number] = me.textbox.text .
¤ ¤ ¤
¤ ¤ ¤ Then in the statement I have an if statement
¤ ¤ ¤
¤ ¤ ¤ IF combobox.text = option1 Then
¤ ¤ ¤ e.databaseadapt er.GetDataBy2() 'which is the query i built
¤ ¤ ¤ end if
¤ ¤ ¤
¤ ¤ ¤ I get an error each time, and can't figure out if it is with the sql
¤ ¤ ¤ statement, or the execution. Is there a search critria field i need
¤ ¤ ¤ to put in place of me.textbox.text ?
¤ ¤ >
¤ ¤ What is the error that is being generated? BTW, Number is a Jet reserved word so it may not be a
¤ ¤ good choice for a column name.
¤ ¤ >
¤ ¤ Paul
¤ ¤ ~~~~
¤ ¤ Microsoft MVP (Visual Basic)
¤ ¤ >
¤ ¤ This is basicly the error I get.
¤ ¤ >
¤ ¤ >http://img107.imageshack.us/img107/8965/vbcn6.jpg-Hide quoted text -
¤ ¤ >
¤ ¤ - Show quoted text -
¤ ¤
¤ ¤ Any Ideas?
¤ >
¤ Yes, the error indicates that one of the column names or criteria is not being recognized. I didn't
¤ see your complete statement but it should look something like the following (assuming Number is a
¤ numeric field):
¤ >
¤ "WHERE [Number] = " & me.textbox.text
¤ >
¤ In your example, me.textbox.text will not be evaluated until it is sent to the database engine
¤ (which will have no clue as to what it is).
¤ >
¤ Paul
¤ ~~~~
¤ Microsoft MVP (Visual Basic)
¤
¤ SELECT [Asset Tag Number], [User], Username, [Department Name],
¤ [Asset Name], [Asset Type], Catergory, [Serial Number], [Purchase
¤ Order Number],
¤ [Purchase Price], [Purchase Date], Warrenty,
¤ Notes
¤ FROM PPC_Inventory
¤ WHERE '[Asset Tag Number] =' & me.ToolStripTex tBox1.[text]
¤ ORDER BY [Asset Tag Number]
¤
¤ is my query, in query builder. No luck still. any help?

Warranty is spelled incorrectly. Is that how it appears in the database table?
Paul
~~~~
Microsoft MVP (Visual Basic)
Apr 20 '07 #7
On Apr 20, 10:50 am, Paul Clement
<UseAdddressAtE ndofMess...@sws pectrum.comwrot e:
On 20 Apr 2007 07:22:37 -0700, Riva...@gmail.c om wrote:

¤ ¤ On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.c om wrote:
¤ ¤ >
¤ ¤ ¤ I am using a Access Database to search/add a bunch of information in
¤ ¤ ¤ MS VB.net 2005 express. In the query (querybuilder) everything seems
¤ ¤ ¤ right, but in the WHERE statement I use [Number] = me..textbox.tex t .
¤ ¤ ¤
¤ ¤ ¤ Then in the statement I have an if statement
¤ ¤ ¤
¤ ¤ ¤ IF combobox.text = option1 Then
¤ ¤ ¤ e.databaseadapt er.GetDataBy2() 'which is the query i built
¤ ¤ ¤ end if
¤ ¤ ¤
¤ ¤ ¤ I get an error each time, and can't figure out if it iswith the sql
¤ ¤ ¤ statement, or the execution. Is there a search critriafield i need
¤ ¤ ¤ to put in place of me.textbox.text ?
¤ ¤ >
¤ ¤ What is the error that is being generated? BTW, Number is aJet reserved word so it may not be a
¤ ¤ good choice for a column name.
¤ ¤ >
¤ ¤ Paul
¤ ¤ ~~~~
¤ ¤ Microsoft MVP (Visual Basic)
¤ ¤ >
¤ ¤ This is basicly the error I get.
¤ ¤ >
¤ ¤ >http://img107.imageshack.us/img107/8...jpg-Hidequoted text -
¤ ¤ >
¤ ¤ - Show quoted text -
¤ ¤
¤ ¤ Any Ideas?
¤ >
¤ Yes, the error indicates that one of the column names or criteria is not being recognized. I didn't
¤ see your complete statement but it should look something like the following (assuming Number is a
¤ numeric field):
¤ >
¤ "WHERE [Number] = " & me.textbox.text
¤ >
¤ In your example, me.textbox.text will not be evaluated until it is sent to the database engine
¤ (which will have no clue as to what it is).
¤ >
¤ Paul
¤ ~~~~
¤ Microsoft MVP (Visual Basic)
¤
¤ SELECT [Asset Tag Number], [User], Username, [Department Name],
¤ [Asset Name], [Asset Type], Catergory, [Serial Number], [Purchase
¤ Order Number],
¤ [Purchase Price], [Purchase Date], Warrenty,
¤ Notes
¤ FROM PPC_Inventory
¤ WHERE '[Asset Tag Number] =' & me.ToolStripTex tBox1.[text]
¤ ORDER BY [Asset Tag Number]
¤
¤ is my query, in query builder. No luck still. any help?

Warranty is spelled incorrectly. Is that how it appears in the database table?

Paul
~~~~
Microsoft MVP (Visual Basic)
yea, thats not the problem. its spelled like that in the database too.

Apr 20 '07 #8
On 20 Apr 2007 08:42:18 -0700, Ri*****@gmail.c om wrote:

¤ ¤ ¤ This is basicly the error I get.
¤ ¤ ¤ >
¤ ¤ ¤ >http://img107.imageshack.us/img107/8...jpg-Hidequoted text -
¤ ¤ ¤ >
¤ ¤ ¤ - Show quoted text -
¤ ¤ ¤
¤ ¤ ¤ Any Ideas?
¤ ¤ >
¤ ¤ Yes, the error indicates that one of the column names or criteria is not being recognized. I didn't
¤ ¤ see your complete statement but it should look something like the following (assuming Number is a
¤ ¤ numeric field):
¤ ¤ >
¤ ¤ "WHERE [Number] = " & me.textbox.text
¤ ¤ >
¤ ¤ In your example, me.textbox.text will not be evaluated until it is sent to the database engine
¤ ¤ (which will have no clue as to what it is).
¤ ¤ >
¤ ¤ Paul
¤ ¤ ~~~~
¤ ¤ Microsoft MVP (Visual Basic)
¤ ¤
¤ ¤ SELECT [Asset Tag Number], [User], Username, [Department Name],
¤ ¤ [Asset Name], [Asset Type], Catergory, [Serial Number], [Purchase
¤ ¤ Order Number],
¤ ¤ [Purchase Price], [Purchase Date], Warrenty,
¤ ¤ Notes
¤ ¤ FROM PPC_Inventory
¤ ¤ WHERE '[Asset Tag Number] =' & me.ToolStripTex tBox1.[text]
¤ ¤ ORDER BY [Asset Tag Number]
¤ ¤
¤ ¤ is my query, in query builder. No luck still. any help?
¤ >
¤ Warranty is spelled incorrectly. Is that how it appears in the database table?
¤ >
¤ Paul
¤ ~~~~
¤ Microsoft MVP (Visual Basic)
¤
¤ yea, thats not the problem. its spelled like that in the database too.

You're not trying to run this from the query builder are you?
Paul
~~~~
Microsoft MVP (Visual Basic)
Apr 20 '07 #9
On Apr 20, 3:15 pm, Paul Clement
<UseAdddressAtE ndofMess...@sws pectrum.comwrot e:
On 20 Apr 2007 08:42:18 -0700, Riva...@gmail.c om wrote:

¤ ¤ ¤ This is basicly the error I get.
¤ ¤ ¤ >
¤ ¤ ¤ >http://img107.imageshack.us/img107/8...Hidequotedtext -
¤ ¤ ¤ >
¤ ¤ ¤ - Show quoted text -
¤ ¤ ¤
¤ ¤ ¤ Any Ideas?
¤ ¤ >
¤ ¤ Yes, the error indicates that one of the column names or criteria is not being recognized. I didn't
¤ ¤ see your complete statement but it should look something likethe following (assuming Number is a
¤ ¤ numeric field):
¤ ¤ >
¤ ¤ "WHERE [Number] = " & me.textbox.text
¤ ¤ >
¤ ¤ In your example, me.textbox.text will not be evaluated until it is sent to the database engine
¤ ¤ (which will have no clue as to what it is).
¤ ¤ >
¤ ¤ Paul
¤ ¤ ~~~~
¤ ¤ Microsoft MVP (Visual Basic)
¤ ¤
¤ ¤ SELECT [Asset Tag Number], [User], Username, [Department Name],
¤ ¤ [Asset Name], [Asset Type], Catergory, [Serial Number], [Purchase
¤ ¤ Order Number],
¤ ¤ [Purchase Price], [Purchase Date], Warrenty,
¤ ¤ Notes
¤ ¤ FROM PPC_Inventory
¤ ¤ WHERE '[Asset Tag Number] =' & me.ToolStripTex tBox1.[text]
¤ ¤ ORDER BY [Asset Tag Number]
¤ ¤
¤ ¤ is my query, in query builder. No luck still. any help?
¤ >
¤ Warranty is spelled incorrectly. Is that how it appears in the database table?
¤ >
¤ Paul
¤ ~~~~
¤ Microsoft MVP (Visual Basic)
¤
¤ yea, thats not the problem. its spelled like that in the database too.

You're not trying to run this from the query builder are you?

Paul
~~~~
Microsoft MVP (Visual Basic)
Yes I am, alternative?

Apr 20 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3397
by: mfyahya | last post by:
Hi, I'm new to databases :) I need help speeding up select queries on my data which are currently taking 4-5 seconds. I set up a single large table of coordinates data with an index on the fields I use most frequently in select queries. The data is about 100MB and index is 80MB. The table has the following structure: CREATE TABLE `ptimes` ( `id` INT UNSIGNED NOT NULL , `rc` CHAR ( 1 ) UNSIGNED NOT NULL ,
0
3949
by: s_gregory | last post by:
The mdb is considerable size 70 +- mb. A complex union query was working well, but when an additional union select... was added into the query, selecting identical fields from a different source, it began to have problems. Failure was observed only in a few PC's at first. For example, in an NT 4.0 SP6 PC, it continued to work OK. But in my Win 2k laptop, it failed. As the union query was gradually simiplified in testing, the failure...
1
1644
by: Philip | last post by:
Hey everyone, I've got a real newbie question and I'll try to make some sense as I explain it. I've got a three tables for simplification. SCREENS (screens names) CONTROLS (control names) SCREEN PAGES (page text)
4
1774
by: Bob Alston | last post by:
Some more, rather specific Access performance questions. IN a split front-end & back-end Access/Jet ONLY LAN situation, and with all query criteria fields and join fields indexed: 1. Is is good form to have a single query with base table with criteria joined to a related table - all in one query? Or should I do a two-step, first query does selection of main table and then join with other table? 2. I have a table with multiple...
9
3937
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result - I have read every post out there and spent hours trying to figure out the problem with no success whatsoever - I have constrained the problem to one form however, and I think it's hiding somewhere in my code associated with this form, which is...
8
4459
by: Sid | last post by:
I hope someone could help me with this. I am trying to setup a criteria to decide when to allow/not allow user to click on the check box. logically it looks simple but I am not able to incorporate in my data access page. I have a numerical field called tier status and right next to it I have a checkbox. I would like to allow user to check and uncheck the checkbox as long as the tier
1
19397
MMcCarthy
by: MMcCarthy | last post by:
Access has a number of built-in functions which can be generally used in queries or VBA code. Some of the more common ones are: Note: anything in square brackets is optional Date Functions Date() - Returns the current system date Now() - Returns the current system timestamp (date and time)
0
7576
MMcCarthy
by: MMcCarthy | last post by:
The more data you include in your tables the more you will need to have indexes to search and sort that data. However, there is a balance between having enough indexes and too many. Too many indexes will slow down the speed of updates on your records. Access presets a number of Indexes for you. If you look in Tools ... Options under the Tables/Queries tab you will see that under "Auto Index on Import/Create" there is a list as follows: ...
2
2287
by: MNNovice | last post by:
I am working on a database on my CD collection using Access 2003. Some of the table structures are given below. Table 1 tblMusicCategory Field 1: MusicCategoryID - Auto Number (PK) Field 2: MusicCategory - text Field 3: MusicCategoryAbbv - text Table 2 tblArtists Field 1 ArtistID - Auto Number (PK)
0
8349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.