Dr. Hammond

I took your advise and moved the DB error checking up higher. As far as I can tell, I have no idea what I am doing!

There I said it!

It will NOT populate that listbox even when I hard code the name of the dTradeName ("Nexuim") into the SQLQuery. It clears all the rows of the listbox fine but thats about it.

I even stripped the program down to its bare parts to work.  Here it is:

CODE:
 Dim rs as RecordSet

 // 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 = '" + mdName.text + "'") // rs = app.DirectoryDB.SQLSelect("SELECT dNumber, dTradeName, dGenericName, dUsage, dAWC FROM Directory WHERE dTradeName LIKE '%" + mdName.text + "%'")

   else
     MsgBox"Please Select a valid Search Parameter to perform search."
   end

   // Display Error If One Occurred
   if App.DirectoryDB.Error then
     App.DisplayDatabaseError()
     return
   end if

   // Show Drugs if they were found
   If rs.RecordCount <> 0 then
     // Medication or Drug found
     // Remove Any Existing Line Items first
     mdList.DeleteAllRows

     // Add Line Items
     if rs <> nil and rs.RecordCount > 0 then
       while rs.EOF = false

         // Add Line Item
         mdList.AddRow rs.Field("dTradeName").StringValue
mdList.Cell(mdList.LastIndex, 1) = rs.Field("dGenericName").StringValue
         mdList.Cell(mdList.LastIndex, 2) = rs.Field("dUsage").StringValue
         mdList.Cell(mdList.LastIndex, 3) = rs.Field("dAWC").StringValue
         mdList.Cell(mdList.LastIndex, 0) = rs.Field("dNumber").StringValue

         // Go to the next record
         rs.MoveNext
       wend
     end if

   else
     // 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
   End

 else
   // Error as no Medication or Drug was entered
   MsgBox"Please enter a Prescription Medication or Drug to search for."
 end
END CODE:

I moved the Error checking up more, not sure if that is correct or not.

The ListBox code I foudn in one of my older programs but there is a catch. the older program used a Main Patient DB then there was a Medication that was tied tot he Patient DB as each patient could have unlimited medications listed for them. So it uses a LineItemID number. Anyway I played with that and no go either.

I am surprised there are no SQL people on here that could jsut show me an example of how basicly to get started.

Jonathon



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.3/474 - Release Date: 10/13/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>

Reply via email to