I've written a style template program that allows me to apply pre-defined attributes to selected tables  It works very nicely, but as I add templates, its getting kind of hard to FIND the template I'm after & would be much easier to have them listed alphabetically.  I'm populating the multi-list box from a tab file called TEMP.  I thought I would be able to query this table to order it, then use the results to populate the array that is used in the multilist box.  My code looks like this:
 
  1. Sub Populate_TemplateName
  2.  Open Table "c:\mapinfo\frontier\template.tab" as TEMP Hide 'open the table in the background
  3.  i = TableInfo(TEMP,TAB_INFO_NROWS) 'count the number of rows ie the number of defined templates
  4.  i = i + 1 'add one cos we're going to include a "none" field in the array
  5.  Redim TemplateName(i)
  6.  TemplateName(1) = "None" 'add "none" field.
  7.  Select * from TEMP order by TemplateName into TEMP1
  8.  Fetch First from TEMP1
  9.  For j = 2 to i 'assign the templatename to each field of the array, starting with field 2.
  10.     TemplateName(j)= TEMP1.TemplateName
  11.     Fetch Next from TEMP1
  12.  Next
  13.  Close table TEMP1
  14.  Close table TEMP
  15. End Sub
I get an error at line 7:  "Cannot use an array or user defined type in an expression".  The ORDER BY is causing the problem, if I delete that, I don't get an error, but I also don't get an alphabetical listing of my templates.  What am I doing wrong?  I've looked in the archive and tried
 
Select TemplateName from TEMP order by TemplaneName into TEMP1
 
after reading Daniel Bowers solution, but this doesn't work either.  I'm stuck.  Any ideas??
 
Thanks,
 
*********************************************
Michelle Smith
Technical Manager
Frontier Mapping Pty Ltd
[EMAIL PROTECTED]
www.frontiermapping.com.au
********************************************

Reply via email to