By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

Access queries/ Search criteria

P: n/a
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.databaseadapter.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
Share this Question
Share on Google+
11 Replies


P: n/a
On 18 Apr 2007 05:17:50 -0700, Ri*****@gmail.com 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.databaseadapter.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

P: n/a
On Apr 18, 9:59 am, Paul Clement
<UseAdddressAtEndofMess...@swspectrum.comwrote:
On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.com 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.databaseadapter.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

P: n/a
On Apr 18, 1:34 pm, Riva...@gmail.com wrote:
On Apr 18, 9:59 am, Paul Clement

<UseAdddressAtEndofMess...@swspectrum.comwrote:
On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.com 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.databaseadapter.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

P: n/a
On 19 Apr 2007 05:14:37 -0700, Ri*****@gmail.com wrote:

On Apr 18, 1:34 pm, Riva...@gmail.com wrote:
On Apr 18, 9:59 am, Paul Clement
>
>
>
>
>
<UseAdddressAtEndofMess...@swspectrum.comwrote:
On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.com 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.databaseadapter.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

P: n/a
On Apr 19, 10:23 am, Paul Clement
<UseAdddressAtEndofMess...@swspectrum.comwrote:
On 19 Apr 2007 05:14:37 -0700, Riva...@gmail.com wrote:

On Apr 18, 1:34 pm, Riva...@gmail.com wrote:
On Apr 18, 9:59 am, Paul Clement
>
>
>
>
> <UseAdddressAtEndofMess...@swspectrum.comwrote:

On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.com 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.databaseadapter.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.ToolStripTextBox1.[text]
ORDER BY [Asset Tag Number]

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

Apr 20 '07 #6

P: n/a
On 20 Apr 2007 07:22:37 -0700, Ri*****@gmail.com wrote:

On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.com 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.databaseadapter.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.ToolStripTextBox1.[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

P: n/a
On Apr 20, 10:50 am, Paul Clement
<UseAdddressAtEndofMess...@swspectrum.comwrote:
On 20 Apr 2007 07:22:37 -0700, Riva...@gmail.com wrote:

On 18 Apr 2007 05:17:50 -0700, Riva...@gmail.com 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.databaseadapter.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.ToolStripTextBox1.[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

P: n/a
On 20 Apr 2007 08:42:18 -0700, Ri*****@gmail.com 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.ToolStripTextBox1.[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

P: n/a
On Apr 20, 3:15 pm, Paul Clement
<UseAdddressAtEndofMess...@swspectrum.comwrote:
On 20 Apr 2007 08:42:18 -0700, Riva...@gmail.com 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.ToolStripTextBox1.[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

P: n/a
On 20 Apr 2007 12:41:46 -0700, Ri*****@gmail.com wrote:
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.ToolStripTextBox1.[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?

Can't you just hard code the value during testing? The query builder doesn't really know anything
about the TextBox.

If it's preventing you from saving the query then you should be able to enter the statement in the
Properties Windows for the object.
Paul
~~~~
Microsoft MVP (Visual Basic)
Apr 23 '07 #11

P: n/a
On Apr 23, 10:45 am, Paul Clement
<UseAdddressAtEndofMess...@swspectrum.comwrote:
On 20 Apr 2007 12:41:46 -0700, Riva...@gmail.com wrote:

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.ToolStripTextBox1..[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?

Can't you just hard code the value during testing? The query builder doesn't really know anything
about the TextBox.

If it's preventing you from saving the query then you should be able to enter the statement in the
Properties Windows for the object.

Paul
~~~~
Microsoft MVP (Visual Basic)
Anyone use VB 2005 express and know a solution for queries using a
textbox? It hangs on the me.databaseadapter.GetDataBy2() statement,
I'm not sure what else I can use.

Apr 26 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.