access database search and display

Reply

Join Date: Apr 2006
Posts: 36
Reputation: Shefali is an unknown quantity at this point 
Solved Threads: 0
Shefali Shefali is offline Offline
Light Poster

access database search and display

 
0
  #1
Aug 1st, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: access database search and display

 
0
  #2
Aug 1st, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 36
Reputation: Shefali is an unknown quantity at this point 
Solved Threads: 0
Shefali Shefali is offline Offline
Light Poster

Re: access database search and display

 
0
  #3
Aug 1st, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: access database search and display

 
0
  #4
Aug 1st, 2006
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.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim conConnection As New ADODB.Connection
  2. Dim cmdCommand As New ADODB.Command
  3. Dim rstRecordSet As New ADODB.Recordset
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
Attached Files
File Type: zip CODE_UPLOAD1065010142000.zip (14.0 KB, 237 views)
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 36
Reputation: Shefali is an unknown quantity at this point 
Solved Threads: 0
Shefali Shefali is offline Offline
Light Poster

Re: access database search and display

 
0
  #5
Aug 2nd, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 36
Reputation: Shefali is an unknown quantity at this point 
Solved Threads: 0
Shefali Shefali is offline Offline
Light Poster

Re: access database search and display

 
0
  #6
Aug 2nd, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 36
Reputation: Shefali is an unknown quantity at this point 
Solved Threads: 0
Shefali Shefali is offline Offline
Light Poster

Re: access database search and display

 
0
  #7
Aug 8th, 2006
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC