Hey guys i have a question am having trouble in displaying record in a list box, what i want to achieve is this... i have 2 check boxes, checkbox1 is name MEASLES and checkbox is name "CHICKEN POX". i have a database name MEDICALDB and has 4 tables named STUDENT NUMBER, NAME, CHIKEN POX AND MEASLE..
i have this example database record:
Student Number Name Chiken Pox Measles
200013253 Darrel NO NO
200013254 Gary YES NO
200013255 Norman NO YES
200013256 Larry YES YES
The scenarion i wanted to search for the names that have value of YES in the Chicken Pox Field and display the name in a listbox..
I'am having trouble on how to implement it in my program so far i have this codes:
[CODE=vb]
Dim rsShowrec1 As New ADODB.Recordset
Dim cnn As New ADODB.Connectio n
Set cnn = New ADODB.Connectio n
cnn.ConnectionS tring = _
"Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=" & App.Path & "\MedicalDB.mdb ;"
cnn.Open
If check1.value = 1 Then
Label1.caption = "YES"
On Error Resume Next
rsShowrec1.Sour ce = "SELECT * FROM MecidalData where [CHICKEN POX] = ' " & Label1.caption & " '
rsShowrec1.Open , cnn, adOpenStatic, adLockOptimisti c
If rsShowrec1.EOF <> True Then
List1.AddItem rsShowrec1.Fiel ds("Name").Valu e
rsShowrec1.Move Next
end if
End Sub
[/CODE]
So far its not working... Any help will do... Thank you... i hope your getting wat i want to achieve... By d way am using ADODB for my database connection.
i have this example database record:
Student Number Name Chiken Pox Measles
200013253 Darrel NO NO
200013254 Gary YES NO
200013255 Norman NO YES
200013256 Larry YES YES
The scenarion i wanted to search for the names that have value of YES in the Chicken Pox Field and display the name in a listbox..
I'am having trouble on how to implement it in my program so far i have this codes:
[CODE=vb]
Dim rsShowrec1 As New ADODB.Recordset
Dim cnn As New ADODB.Connectio n
Set cnn = New ADODB.Connectio n
cnn.ConnectionS tring = _
"Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=" & App.Path & "\MedicalDB.mdb ;"
cnn.Open
If check1.value = 1 Then
Label1.caption = "YES"
On Error Resume Next
rsShowrec1.Sour ce = "SELECT * FROM MecidalData where [CHICKEN POX] = ' " & Label1.caption & " '
rsShowrec1.Open , cnn, adOpenStatic, adLockOptimisti c
If rsShowrec1.EOF <> True Then
List1.AddItem rsShowrec1.Fiel ds("Name").Valu e
rsShowrec1.Move Next
end if
End Sub
[/CODE]
So far its not working... Any help will do... Thank you... i hope your getting wat i want to achieve... By d way am using ADODB for my database connection.
Comment