[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Doubt in vb application

Posted on 2004-11-04
3
Medium Priority
?
246 Views
Last Modified: 2012-05-05
hello sir,
       I have data records as "staff code"& "test" in MS access
In vb List box I have to dispaly the tests that are passed by there staff code.even same staff code may passed different
tests,that should be displayed in the list box..

          thank you
0
Comment
Question by:sivara
1 Comment
 

Accepted Solution

by:
askmeaks earned 400 total points
ID: 12522873
Although, you question seems hazy, you'd had better tried ADO's Command object & Recordset object to parse the SQL queries in response to your needs, and build up the listbox by using the recordset. A simple example may be like :

Private Function PopulateStaffCode() as Boolean
On Error goto ErrorHandler
Dim xConn as new ADODB.Connection
Dim xRs as new ADODB.Recordset

xConn.Open "<Connection String>"
xRs.Open "Select staffcode from <table name>",xConn, & _
adOpenForwardOnly,adLockOptimistic,adCMDTable

lstStfcode.Clear
while not xRs.EOF=TRUE
   lstStfCode.AddItem xrs.Fields(0).value
   xRs.MoveNext
Wend
PopulateStaffCode=TRUE
Exit Function
ErrorHandler:
lstStfCode.Clear
PopulateStaffCode=FALSE
End Function

Private Function PopulateTestRecord() as Boolean
Dim xConn as New ADODB.Connection
Dim xRs as New ADODB.Recordset

xConn.Open "<Connection String>"
xRs.open "select test from <table name> where staffcode=" & trim(lstStfCOde.item(lstStfCode.ListIndex)),xConn,adOpenForwardOnly, & _
adLockOptimistic, adCMDTable

lstTestRec.Clear
While Not xRs.EOF=TRUE
   lstTestRec.AddItem xRs.Fields(0).Value
   xRs.MoveNext
Wend
PopulateTestRecord=TRUE
Exit Function
ErrorHandler:
lstTestRec.Clear
PopulateTestRecord=FALSE
End Function


The first function will populate a listbox named lstStfCode by code of all the staff. The next function will populate the next listbox named lstTestRec by details of all the test performed by the staff selected in the first listbox.

May be it will help. For more details you may contact me at v_basic@rediffmail.com
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Progress
Screencast - Getting to Know the Pipeline

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question