Chris2015
Chris2015

Reputation: 1050

Equivalent of .RowSource for Text Box

What is the equivalent of .RowSource for a text box?

For example, I have assigned a ComboBox value using the following:

With Forms("fmOne").SearchLname
    .RowSource = "SELECT DISTINCT(LName) From tbCase;"
    Call .Requery
End With

Is there a textbox equivalent?

thanks.

Upvotes: 1

Views: 3082

Answers (2)

Andre
Andre

Reputation: 27644

You can use an expression as control source of a textbox, e.g.

The third column of the selected row of a multi-column combobox on the same form:

=MyCombobox.Column(2)

A DLookup query based on another textbox:

=DLookup("foo", "myTable", "bar = '" & [OtherTextbox] & "'")

This will need a .Requery though after updating [OtherTextbox], I think.

Upvotes: 1

tyg
tyg

Reputation: 15579

Since a TextBox can only display a single value (there is no dropdown of values to select from), there is no need for anything like the RowSource property.

You can bind the TextBox to a value though, the same as you can do with any other control, by using the ControlSource property. That will automatically fill in the apropriate value from the current record if you bound the underlying form to a data source.

This is, however, not comparable to the RowSource property of a combo box.

Upvotes: 1

Related Questions