OK, your code looks perfect, and you have proven that the query works. Is it possible that mdList isn't actually visible? Are you possibly looking at another listbox on the screen at the time this code executes? It's a stretch, but it's the only think I can think of, especially when code like mdList.AddRow "This" doesn't do anything.
Does the value of mdList.LastIndex change? Tim > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > Jonathon Bevar > Sent: Friday, October 13, 2006 9:41 PM > To: REALbasic NUG > Subject: Re: SQL Query to ListBox help! > > > Ok here it is, I went through this with a fine tooth comb and I > have it down > to were I can SEE the data being SQLQueryed BUT it will NOT populate into > the list box. > > I have found a very easy and simply method from the other forum, as I did > some digging to find the answer. > > > CODE: > Dim rs as RecordSet > Dim str0, str1, str2, str3 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 + "%'") > else > MsgBox"Please Select a valid Search Parameter to perform search." > Exit > 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 > > // Remove Any Existing Line Items > mdList.DeleteAllRows > > // Add Line Items > if rs <> nil and rs.RecordCount > 0 then > while not rs.eof > str0 = rs.field("dTradeName").stringValue > str1 = rs.Field("dGenericName").StringValue > str2 = rs.Field("dUsage").StringValue > str3 = rs.Field("dAWC").StringValue > mdList.addRow "This" // str0 > mdList.Cell(mdList.LastIndex, 1) = str1 > mdList.Cell(mdList.LastIndex, 2) = str2 > mdList.Cell(mdList.LastIndex, 3) = str3 > '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 > str0 = "" > str1 = "" > str2 = "" > str3 = "" > rs.moveNext > wend > rs.close > 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: > > Now, I have even used STRINGS to see the data come up in the break points > and it does come up so the SQLQuery is working as I see the data > enter into > the 4 str strings. > > It will NOT populate the listbox, and I have no idea why. I even used a > "string" as you can see in the code to test it and it will not even list > into one of the cells of the listbox. > > HELP! I did my homework and I need this to work, why isn't? This is the > basic of all basic listbox from SQLQuery there can be. > > I am just tired is all... > > > > -- > 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> > > _______________________________________________ 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>
