473,485 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Searching the database for numbers

62 New Member
I have a database that some coulmns containg numbers and I need to search using the value inputted in a text box. Am unable to do it with this code
Expand|Select|Wrap|Line Numbers
  1. If Combo1.Text = "Result" Then
  2.     RSSearchS.Open " SELECT * FROM follow WHERE Result = '" & Text2.Text _
  3. & "' ORDER BY Workorder", CnWorkOrder, adOpenDynamic, adLockOptimistic
  4.  
where text2.text is the text box that contains the number i want to search for in the database.
Please could you help me out.
Thank you.
Jan 29 '07 #1
3 989
sashi
1,754 Recognized Expert Top Contributor
I have a database that some coulmns containg numbers and I need to search using the value inputted in a text box. Am unable to do it with this code
Expand|Select|Wrap|Line Numbers
  1. If Combo1.Text = "Result" Then
  2.     RSSearchS.Open " SELECT * FROM follow WHERE Result = '" & Text2.Text _
  3. & "' ORDER BY Workorder", CnWorkOrder, adOpenDynamic, adLockOptimistic
  4.  
where text2.text is the text box that contains the number i want to search for in the database.
Please could you help me out.
Thank you.
Hi there,

Take a look at below modification, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1. Dim TMPSQL As String
  2.  
  3. TMPSQL = ""
  4. TMPSQL = "SELECT * FROM follow " _
  5.               & "WHERE Result LIKE '" & Trim(Text2.Text) & "'" _
  6.               & "ORDER BY Workorder ASC;"
  7.  
  8. If Combo1.Text = "Result" Then
  9.     RSSearchS.Open TMPSQL, CnWorkOrder, adOpenDynamic, adLockOptimistic
  10. EndIf
  11.  
Jan 29 '07 #2
Killer42
8,435 Recognized Expert Expert
If the field type is numeric, then don't use quotes around the search value. For example...
Expand|Select|Wrap|Line Numbers
  1. If Combo1.Text = "Result" Then
  2.   RSSearchS.Open "SELECT * FROM follow WHERE Result = " & Text2.Text _
  3.   & " ORDER BY Workorder", CnWorkOrder, adOpenDynamic, adLockOptimistic
Jan 30 '07 #3
nkechifesie
62 New Member
[RESOLVED]
Thank you very much.I removed the single quote and it works very well.
Jan 30 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
5457
by: sffan | last post by:
I am new to database programming and was curious how others solve the problem of storing encrypted in data in db table columns and then subsequently searching for these records. The particular...
3
3242
by: Stewart Allen | last post by:
Hi there I'm trying to find part serial numbers between 2 numbers. The user selects a part number from a combo box and then enters a range of serial numbers into 2 text boxes and the resulting...
33
2427
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following...
3
3718
by: inkexit | last post by:
I need help figuring out what is wrong with my code. I posted here a few weeks ago with some code about creating self similar melodies in music. The coding style I'm being taught is apparently a...
5
2380
by: justobservant | last post by:
When more than one keyword is typed into a search-query, most of the search-results displayed indicate specified keywords scattered throughout an entire website of content i.e., this is shown as...
23
35948
Chrisjc
by: Chrisjc | last post by:
I would first like to say that I am very new to PHP/MySQL... I have a database full of infomation already. to view what my database looks like and how it is set up please see the following link (...
5
2718
by: ebernedo | last post by:
Hey guys, I'm new here and also pretty new to access I'm creating a database at work, and need to be able to search things within it to find the right part number in our case... heres a sample...
20
2498
by: tkip | last post by:
Hello everyone. I have been working on this DB for quite some time and still can't figure out a way to do what I want to do. It's a database that keep track of drawings and engineering change etc....
5
3163
by: lemlimlee | last post by:
hello, this is the task i need to do: For this task, you are to develop a Java program that allows a user to search or sort an array of numbers using an algorithm that the user chooses. The...
0
7090
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,...
0
7116
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7161
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...
1
6825
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...
0
7275
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5418
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,...
0
4551
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
247
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.