Reading in records from Access
Posted on 2000-03-16
Here is my code:
Dim dbs As Database
Dim rst As Recordset
Set dbs = OpenDatabase("a\studinfo.mdb")
Set rst = dbs.openrecordset("SELECT TblStudent.StNo, TblStudent.Name, TblTranscript.Desc,TblTranscript.Grade, TblCourses.Credits " _
& "FROM TblCourses INNER JOIN (TblStudent INNER JOIN TblTranscript ON TblStudent.StNo = TblTranscript.StNo) " _
& "ON TblCourses.Desc = TblTranscript.Desc;")
This SQL, as I understand it establishes a frame in which records can be retrieved, once the query is executed. Since this is a select query, I want to do the following in VB:
1. execute the select SQL above so that records are retrieved into the rst based on entered data (in a separate textbox)which could reside in one of the fields, and then return the records which represent the entire recordset.
An example is a user enters a student ID number in a textbox control and this data is used as the parameter by which the query returns data.
3. Populate a listview object with the returned records.
Is what you see here the best way to do this? If it is then please help me to complete this project. If you have a better way then please advise.