I have a problem that the query will not populate the listbox. It runs and
the error checks do work but all i get is an empty listbox. The RBForum was
helpful but I am at a stand still.
Any help or ideas would be great.
CODE:
Dim rs as RecordSet
Dim i as Integer
Dim v as String
// Search for Medication or Drug
If mdName.text <> "" then
If mdParameter.text = "Trade Name" then
// Search Parameter of TradeName
rs = app.DirectoryDB.SQLSelect("SELECT * FROM Directory WHERE
dTradeName LIKE '%" + mdName.text + "%'")
ElseIf mdParameter.text = "Generic Name" then
// Search Parameter of GenericName
rs = app.DirectoryDB.SQLSelect("SELECT * FROM Directory WHERE
dGenericName LIKE '%" + mdName.text + "%'")
ElseIf mdParameter.text = "Medication Usage" then
// Search Parameter of Medication Usage
rs = app.DirectoryDB.SQLSelect("SELECT * FROM Directory WHERE dUsage
LIKE '%" + mdName.text + "%'")
else
MsgBox"Please Select a valid Search Parameter to perform search."
end
// Show Drugs that were found
If rs.RecordCount = 0 then
// No Medication or Drug was found
MsgBox"There was NO Precription Medication or Drug found by that Name
in the MedDirectory DataBase."
// Requery the Database
MDQuery.RunQuery
else
mdList.DeleteAllRows
mdList.Columncount = rs.FieldCount
mdList.AddRow rs.IdxField(1).Name
For i = 2 to rs.FieldCount
mdList.Cell(mdList.lastIndex, i - 1) = rs.IdxField(i).Name
'mdList.CellBold(mdList.LastIndex, i - 1) = True
Next
While NOT rs.eof
MsgBox"Got this far - 1"
v = rs.IdxField(1).StringValue
mdList.AddRow v
For i = 2 to rs.fieldcount
mdList.Cell(mdList.lastIndex, i - 1) = rs.IdxField(i).StringValue
MsgBox"Got this far - 2"
next
MsgBox"Got this far - 3"
rs.MoveNext
Wend
End
else
// Error as no Medication or Drug was entered
MsgBox"Please enter a Prescription Medication or Drug to search for."
end
// Display Error If One Occurred
if App.DirectoryDB.Error then
App.DisplayDatabaseError()
return
end if
// Requery the Database
'MDQuery.RunQuery
END CODE:
Jonathon
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.2/472 - Release Date: 10/11/2006
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>