473,549 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ 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 992
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
5464
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 problem that I am facing is in dealing with (privacy) critical information like credit-card #s and SSNs or business critical information like sales...
3
3253
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 query should find every machine that has that part number between the serial number range. The problem is that the serial number stored is a text...
33
2445
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 criteria: I have a list of about 100 numbers which correspond to the ID field and also another 40 say numbers corresponding to the numbers in the...
3
3724
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 lot different from what the pros around here use. I really need help with debugging some program errors more than anything, even though my coding...
5
2383
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 three bolded periods '...' in search-result listings. Additionally, most content is outdated; as many users need up-to-date content. Hence,...
23
35961
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 ( www.triplesource.net/db/ ) As far as what I have so far this is what I can get my drop down box to do... ( http://www.triplesource.net/php/)...
5
2726
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 of what the table looks like: Part # Size Press A FlowRate Press B FlowRate Press C Flow Rate 124 1 0.52 ...
20
2509
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. Aslo, the tables for drawings are grouped by year. I have a Main Form and on that main form, several cmd buttons to initialize sub forms are...
5
3166
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 search algorithms that can be used are Linear Search and Binary Search. The sorting algorithms are bubble, selection and Insertion sort. First, the user...
0
7524
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...
0
7720
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7960
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...
0
7812
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6048
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...
1
5372
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...
0
3483
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1944
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
1061
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.