473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

search records in mdb using vb

please help... i have a vb program which needs to search for employee name inside empmas.mdb, specifically empmas table. the user will input the idnumber on a textbox and from that it will search the name of the employee and display it in a label in my vb program.

all i have is this:


Dim db As Database

Dim rs As Recordset

Dim SQLString As String

Set db = OpenDatabase("C:\empmas.mdb")
Sep 14 '07 #1
3 2154
debasisdas
8,127 Expert 4TB
Try to search using SQL query .

Frame the query dynamically on user input
Sep 14 '07 #2
i'm sorry but i don't know how... i haven't used sql... i'm only a beginner in programming... i've read about SELECT in sql but i haven't understood the concept...

i tried this:
strSQLString = SELECT * FROM empmas WHERE e_empno like '*" & txtEmpNum.text & "*'";
Sep 14 '07 #3
jamesd0142
469 256MB
please help... i have a vb program which needs to search for employee name inside empmas.mdb, specifically empmas table. the user will input the idnumber on a textbox and from that it will search the name of the employee and display it in a label in my vb program.

all i have is this:


Dim db As Database

Dim rs As Recordset

Dim SQLString As String

Set db = OpenDatabase("C:\empmas.mdb")
-------------------
Hi m8, im new to vb myslef but i have managed to successfully do something simular to this.

Dim Cmd2 As OleDb.OleDbCommand
Dim Con2 As OleDb.OleDbConnection
Dim Sql2 As String = Nothing
Dim Reader2 As OleDb.OleDbDataReader
Dim ComboRow2 As Integer = -1
Dim Columns2 As Integer = 0
Dim Category2 As String = Nothing


Con2 = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OleD b.4.0;data source=FAQs.mdb")
Sql2 = "SELECT Question FROM tblQuestion " & _
"WHERE Category_Id = '" & strChosenQuestion & "'"
Cmd2 = New OleDb.OleDbCommand(Sql2, Con2)
Con2.Open()

Reader2 = Cmd2.ExecuteReader()
While Reader2.Read()
For Columns2 = 0 To Reader2.FieldCount - 1
Category2 = Reader2.Item(Columns2) 'READ COLUMN FROM DATABASE
Next
cboQuestion.Items.Add(Category2)
ComboRow2 += 1
End While
Con2.Close()

c if this helps...
Sep 14 '07 #4

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

Similar topics

2
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned...
1
by: arikatla | last post by:
We are using SQL Server 2000 database (with sp3) and recently we faced an interesting issue with full text search. According to SQLServer help page "AND | AND NOT | OR Specifies a logical...
2
by: TH | last post by:
I am (still :) working on a recipe database. Now I am trying to figure out how to set it up for an ingredient search. What I want it to be able to do is to search by one ingredient, sometimes by...
8
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled...
5
by: JP SIngh | last post by:
Hi All This is a complicated one, not for the faint hearted :) :) :) Please help if you can how to achieve this search. We have a freetext search entry box to allow users to search the...
7
by: John | last post by:
hi, i have created a search form, and i want to search for a specific item in a field. e.g. i have a field called colour, which has record1 = 'red, blue, green' and another record2 = 'red' ...
2
by: Arsalan Ahmad | last post by:
Hi, May be I am a newbie, or may be i dont have that much insight in following systems ..i.e. why i have some confusions as below: In many websites, when search is performed on some keywords...
1
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and...
3
by: Redbeard | last post by:
Hi All this is my first time post, be gentle. I am looking at creating a keyword search that searches multiple fields in a Form and then filters records that match the keyword. The Form...
13
by: jfarthing | last post by:
Hi everyone! I am using the script below to search a db. If the is more than one match in the db, all goes well. But if there is only one match in the db, nothing gets displayed. Any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.