Hi guys! Im having a problem from opening a database... i think the code was right.
DocListDummy is a ListBox that contains my doctors_id
DocsList is a ListBox that get (lname,fname,mname)
I want to open a record where doctors_id is equivalent to my DocsListDummy.Text
but im getting this problem. Any ideas? I badly need a help :(
Private Sub DocsList_Click()
Me.DocsListDummy.ListIndex = Me.DocsList.ListIndex
If Me.DocsList.ListIndex = Me.DocsListDummy.ListIndex Then
If rs.State = 1 Then rs.Close
rs.Open "Select * from tbldoctor where doctors_id = '" & Me.DocsListDummy.Text & "'", con, 3, 3
Dim pic As String
With Me
.lblDID.Caption = rs!doctor_id
.lblName.Caption = rs!dlname & ", " & rs!dfname & " " & rs!dmname
.lblAge.Caption = rs!age
.lblSpec.Caption = rs!specialty
pic = rs!dpic
If Me.DocsList.Text = "none" Then
.pbPic.Picture = LoadPicture(ppath & "nopic.jpg")
Else
.pbPic.Picture = LoadPicture(ppath & pic)
End If
End With
End If
rs.Close
End Sub
DocListDummy is a ListBox that contains my doctors_id
DocsList is a ListBox that get (lname,fname,mname)
I want to open a record where doctors_id is equivalent to my DocsListDummy.Text
but im getting this problem. Any ideas? I badly need a help :(
Private Sub DocsList_Click()
Me.DocsListDummy.ListIndex = Me.DocsList.ListIndex
If Me.DocsList.ListIndex = Me.DocsListDummy.ListIndex Then
If rs.State = 1 Then rs.Close
rs.Open "Select * from tbldoctor where doctors_id = '" & Me.DocsListDummy.Text & "'", con, 3, 3
Dim pic As String
With Me
.lblDID.Caption = rs!doctor_id
.lblName.Caption = rs!dlname & ", " & rs!dfname & " " & rs!dmname
.lblAge.Caption = rs!age
.lblSpec.Caption = rs!specialty
pic = rs!dpic
If Me.DocsList.Text = "none" Then
.pbPic.Picture = LoadPicture(ppath & "nopic.jpg")
Else
.pbPic.Picture = LoadPicture(ppath & pic)
End If
End With
End If
rs.Close
End Sub