| | |
access database search and display
![]() |
•
•
Join Date: Apr 2006
Posts: 36
Reputation:
Solved Threads: 0
hello all
i m new to this topic, though I have some experience of using VB to control excel.
I have an access database which has some records. The columns(fields) are first name, lastname, year of birth, city, county, district, state, tel ph number and email id.
Now I want to write a vb code through which the user will search for a person's year of birth(there r multiple people with same year of birth). after this the form shud display the the name of the district in which those persons having the searched year of birth, live. from the list the user wud select the district he wants and the counties within that district shud be displayed. and after selecting a particular county.. the cities within that county shud be displayed.and finally when the user select any of those cities, the email id and the ph number of the matching person(s) shud be displayed.
Comatose.. I have gone thru the link u have given, but cudnt make out much from that. I m really new to this, and any help wud be much appreciated.
thanks.
shefali.
i m new to this topic, though I have some experience of using VB to control excel.
I have an access database which has some records. The columns(fields) are first name, lastname, year of birth, city, county, district, state, tel ph number and email id.
Now I want to write a vb code through which the user will search for a person's year of birth(there r multiple people with same year of birth). after this the form shud display the the name of the district in which those persons having the searched year of birth, live. from the list the user wud select the district he wants and the counties within that district shud be displayed. and after selecting a particular county.. the cities within that county shud be displayed.and finally when the user select any of those cities, the email id and the ph number of the matching person(s) shud be displayed.
Comatose.. I have gone thru the link u have given, but cudnt make out much from that. I m really new to this, and any help wud be much appreciated.
thanks.
shefali.
Do you already have code for this (naturally, not all of it, or you wouldn't be asking) but my question is... have you started the project?
The layout of how I would go about it, is I would make a query for the birth year, and then retrieve all the information about each record for that birth year.....so, if they search by 1979, the database would return a list of records for 1979. Then I would store all the information in arrays for every record in 79, and sift through it in the vb code..... let me know where you are with this, and where I can help.
The layout of how I would go about it, is I would make a query for the birth year, and then retrieve all the information about each record for that birth year.....so, if they search by 1979, the database would return a list of records for 1979. Then I would store all the information in arrays for every record in 79, and sift through it in the vb code..... let me know where you are with this, and where I can help.
•
•
Join Date: Apr 2006
Posts: 36
Reputation:
Solved Threads: 0
thanks for ur reply comatose. actually i havent yet started the project. i am looking around to get some help to get myself started. i m not very sure how do i link access 2003 and vb6.. i mean do i use ado or shud i use the something similar to what is done to link vb and excel.
so once this gets clear to me maybe then i can start with the project.
but i m sure i wud need lots of help.. as i m really new to this.
thanks again.
so once this gets clear to me maybe then i can start with the project.
but i m sure i wud need lots of help.. as i m really new to this.
thanks again.
Definately ADO. How well versed are you in the VB Language? A lot of times, people who understand little about programming at all want to take on pretty hefty tasks.... I'm not insinuating that you are doing that, I just want to make sure that I don't throw too much stuff in the mix that you haven't yet learned.... that said, I'll give a brief explanation of ADO.
ADO is a bunch of classes that allow you to make an object, so that you can connect to a database. You might only need one of the classes, or all of them. Anyway, the first thing you need to do is tell VB you want to use the database system. So, we go to up to the project menu, then references..... once the new window opens scroll down and find "Microsoft ActiveX Data Objects 2.5 Library" or the "Microsoft ActiveX Data Objects 2.6 Library". If you don't have them, your code will not work. Which means you probably don't have access installed on the box or something. Anyway, moving on.
Once VB knows we want to use those classes, we can make objects of them. So first, we need to define the variables that we will use to work with the database.
The first line, is going to make a variable that will let us connect to the database. The second one, will allow us to submit a query, and the last one will define how the record should be returned. Then you have to define a connection string. Really this is a pretty lengthy process.
The attachment is a tutorial in code that I found while surfing around, it might be helpful to you.... it's pretty much a skeleton of how to make VB work with ADO
ADO is a bunch of classes that allow you to make an object, so that you can connect to a database. You might only need one of the classes, or all of them. Anyway, the first thing you need to do is tell VB you want to use the database system. So, we go to up to the project menu, then references..... once the new window opens scroll down and find "Microsoft ActiveX Data Objects 2.5 Library" or the "Microsoft ActiveX Data Objects 2.6 Library". If you don't have them, your code will not work. Which means you probably don't have access installed on the box or something. Anyway, moving on.
Once VB knows we want to use those classes, we can make objects of them. So first, we need to define the variables that we will use to work with the database.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim conConnection As New ADODB.Connection Dim cmdCommand As New ADODB.Command Dim rstRecordSet As New ADODB.Recordset
The attachment is a tutorial in code that I found while surfing around, it might be helpful to you.... it's pretty much a skeleton of how to make VB work with ADO
•
•
Join Date: Apr 2006
Posts: 36
Reputation:
Solved Threads: 0
thank u very much comatose. i will go through the attached file and will try my best to do whatever i can. as far as my vb skills are concerned i m not really very good, but yea i have done some coding and linking vb to other applications like excel and labview.
i hope to get ur guidance if i get messed somewhere.
thanks a lot.
i hope to get ur guidance if i get messed somewhere.
thanks a lot.
•
•
Join Date: Apr 2006
Posts: 36
Reputation:
Solved Threads: 0
i have gone thru the tutorial code and also written my code based on that. as of now i can link my database and also retrieve a data of my choice and display it in a text box.
now what i want is that all data in a certain field to be displayed fully and after that the user can search from that list so that additional narrowed down information wud be displayed.
comatose ur help was invaluable to get me upto this... can u plz guide me further?
hoping to get a reply from u or any other members who wud like to help me a bit.
thanks.
now what i want is that all data in a certain field to be displayed fully and after that the user can search from that list so that additional narrowed down information wud be displayed.
comatose ur help was invaluable to get me upto this... can u plz guide me further?
hoping to get a reply from u or any other members who wud like to help me a bit.
thanks.
•
•
Join Date: Apr 2006
Posts: 36
Reputation:
Solved Threads: 0
seems no one is interested to give me some suggestions or help me.
anywayz..
i have written a code using ado which connect a access database and searches a particular field and displays relevant information from the search results. for instance if the user searches the fone number, if matches then the persons last name, first name and email id is being displayed.
however i want to narrow down the search, like say the user enters the last name, then all the person matching wud be displayed in a listbox and from that if the user clicks one of those persons, subsequesnt information wud be displayed in another list box and so on.
can someone plz help me in this regard.
thanks.
anywayz..
i have written a code using ado which connect a access database and searches a particular field and displays relevant information from the search results. for instance if the user searches the fone number, if matches then the persons last name, first name and email id is being displayed.
however i want to narrow down the search, like say the user enters the last name, then all the person matching wud be displayed in a listbox and from that if the user clicks one of those persons, subsequesnt information wud be displayed in another list box and so on.
can someone plz help me in this regard.
thanks.
![]() |
Similar Threads
- I hava trouble with Microsoft Access database, Pls help me. (Java)
- From * Where =< in Access Database (ASP)
- Searching for a string in an access database (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: How to Show Database In DataGrid Using DAO
- Next Thread: text boxes
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






