AddItemsFromTable method problems....

2633
2
07-06-2010 11:19 AM
NickDeMerchant
New Contributor
Hi there, I am looking at some VBscript and finding that the AddItemsFromTable method does not seem to be working as I am thinking it should.

I have a table that is referenced by DbfFileName.  The value field is called Value and the descriptive field of which I want displayed in the cmb control is Desc. 

When a particular strType is selected, a certain table is called.  What I am finding is that only the value field values are being displayed in the control and not the Desc field values (descriptive text).

If anyone has seen this behaviour or sees any issues on the formatting please let me know.  I have included a code snippet below.

Thanks,

Nick

------------------------------------


select case strType
case "SR", "MR", "HP", "HR", "LP", "EG", "EP"
  SetPageEnabled "pgStatus", true
  SetPageEnabled "pgCulvert", true
  SetPageEnabled "pgCulvert2", true
  SetPageEnabled "pgBridge", false
  SetPageEnabled "pgBeaver", false
  set pg = Layer.Forms("EDITFORM").Pages.Item("pgCulvert")
  select case strType
  case "SR"
   strLabel = "Diameter (in)"
   pg.Controls("chkSlope").Enabled = true
   pg.Controls("chkFish").Enabled = true
   pg.Controls("chkEmbedded").Enabled = true
   pg.Controls("chkRRBed").Enabled = false
   pg.Controls("chkNoGaps").Enabled = false
   pg.Controls("chkBankdist").Enabled = false
   'pg2.Controls("chkAppFoot").Enabled = false
      DbfFileName = DbfPath & "\streamroad_sr.dbf"
   msgbox dbfFileName
   Set objCboControl = Layer.Forms("EDITFORM").Pages.Item("pgCulvert").Controls("cmbDiam")
   objCboControl.clear
   Call ObjCboControl.AddItemsFromTable(DbfFileName, "Value", "Desc") 
  case "MR"
   strLabel = "Diameters (ex: 2/2) (cm)"'ft)"
   pg.Controls("chkSlope").Enabled = true
   pg.Controls("chkFish").Enabled = true
   pg.Controls("chkEmbedded").Enabled = true
   pg.Controls("chkRRBed").Enabled = false
   pg.Controls("chkNoGaps").Enabled = false
   pg.Controls("chkBankdist").Enabled = false
  case "HP"
   strLabel = "End Area (sq.m)"'sqft)"
   pg.Controls("chkSlope").Enabled = false
   pg.Controls("chkFish").Enabled = false
   pg.Controls("chkEmbedded").Enabled = false
   pg.Controls("chkRRBed").Enabled = true
   pg.Controls("chkNoGaps").Enabled = true
   pg.Controls("chkBankdist").Enabled = true
   DbfFileName = DbfPath & "\streamroad_hp.dbf"
   Set objCboControl = Layer.Forms("EDITFORM").Pages.Item("pgCulvert").Controls("cmbDiam")
   objCboControl.clear
   Call ObjCboControl.AddItemsFromTable(DbfFileName, "Value", "Desc")
Tags (3)
0 Kudos
2 Replies
Almarde_Ronde
New Contributor
Hello Nick,

My experience is that a combobox or list only shows 1 column, and the values in the list are set with the Values Field property. If you wish to display the descriptive text in the box, simply say something like

ObjCboControl.AddItemsFromTable DbfFileName, "Desc", "Desc"

("Desc" is actually a reserved word in ArcMap I believe, perhaps need to change the field name to prevent conflict?)

Hope that helps, Almar.
0 Kudos
RolfBroch
Occasional Contributor II
Have you tried to reveres the description and value fields. I remember reading something that if you have the limittolist property set it is reversed... Do not have access to any docs right now but try it out. Instead of using

AddItemsFromTable(DbfFileName, "Value", "Desc")
use
AddItemsFromTable(DbfFileName, "Desc", "Value")
0 Kudos