Distinction between using .text and .value in VBA Access

  • “.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

EDIT: .text can only be called when the control has the focus, while .value can be called any time …

Leave a Comment