views:

40

answers:

1

i am passing the textbox1.text values into a query and sometimes into a string

sometimes i say this:

dim combor1 as string
combor1 = comboReason1.Text

how do i know when i should put combor1=comboreason1.value ??

also why do i need to set focus for a control to reference its property? that doesn't make sense to me

also when i set combor4 = comboReason4.Value and the .value is null, then i get an error about invalid use of null

please help!

+5  A: 
  • ".text" gives you what is displayed on the screen
  • ".value" gives you the underlying value

Both usually give the same result, except when the corresponding control is

  1. a combobox or listbox control
  2. the displayed value differs from the bound column

Example:

  • id_Person is a combobox control in a form
  • the rowsource is "SELECT id_Person, personName FROM Tbl_Person"
  • column widths are "0cm;3cm"
  • bound column is 1

In this situation:

  • id_Person.text displays Tbl_Person.personName
  • id_Person.value displays Tbl_Person.id_Person.

.text property is available only when the corresponding control has the focus.

.text is a string value, therefore it cannot be Null, while .value can be Null

Philippe Grondier