Microsoft
Software
Hardware
Network
Question : search method in VBA Access
iam coding a search routine that if supplied with a set of symptoms then it will then go ahead and retrieve the disease or the diseases that match the symptoms and output the results to the console.but the program only matches for the first symptom supplied by the user and ignores the rest. i dont know why and can you bail me out guys.
Private Sub search_click()
On Error GoTo Err_search_Click
Dim mydata
Dim mysympt
Dim mymed
Dim myprev
Set mydata = CurrentDb.openrecordset("d
isease")
Set mysympt = CurrentDb.openrecordset("s
ymptoms")
Set mymed = CurrentDb.openrecordset("m
edication"
)
Set myprev = CurrentDb.openrecordset("p
revention"
)
With mydata
Do While Not mydata.EOF
match = mysympt.Fields("Sname")
Text7.SetFocus
If InStr(Text7.Text, match) Then
Do While Not mydata.EOF
If mydata.Fields("dname") = mysympt.Fields("dname") Then
Do While Not mymed.EOF
If mymed.Fields("medcode") = mydata.Fields("medcode") Then
Do While Not myprev.EOF
If myprev.Fields("dname") = mydata.Fields("dname") Then
Text20.SetFocus
Text20.Text = mysympt.Fields("dname")
Text23.SetFocus
Text23.Text = mymed.Fields("medtype")
Text26.SetFocus
Text26.Text = myprev.Fields("pname")
Exit Do
End If
myprev.MoveNext
Loop
Exit Do
End If
mymed.MoveNext
Loop
Exit Do
End If
mydata.MoveNext
Loop
Exit Do
Else
mysympt.MoveNext
End If
Loop
End With
Exit_search_Click:
Exit Sub
Err_search_Click:
MsgBox err.Description
'Resume Exit_search_Click
End Sub
Answer : search method in VBA Access
Per recommendation, points NOT refunded and question closed.
Netminder
CS Moderator
Random Solutions
Underlining spaces
Query logic
VB.Net move Items from ListBox to Textboxes
What sort of utility will provide autocomplete suggestions while I am typing text within applications such as Microsoft Word, Internet Explorer, notepad, etc.?
SharePoint 2010 and the URL Length Error
Count consecutive numbers and the attach back to original dataset
PowerPoint AddIn/Custom Ribbon generating macro error
Failover Policy for MSCS 2008 + SQL Server 2008
Rightclick on a node in a treeview
FTP to unix servers from windows using VB 6.0 or Excel VBA