set text box value to result of query

C

CuriousMark

Using VBA, how do I set the value of a text box control on a form to the
result of a query that returns one value? I'm sure I knew this at one point,
but I can't remember and I can't figure it out again. I can do this with a
combo box by setting the RowSource property to the SQL statement, but I can't
figure out how to do it for a text box.
 
S

Stuart McCall

CuriousMark said:
Using VBA, how do I set the value of a text box control on a form to the
result of a query that returns one value? I'm sure I knew this at one
point,
but I can't remember and I can't figure it out again. I can do this with a
combo box by setting the RowSource property to the SQL statement, but I
can't
figure out how to do it for a text box.

Me.TextboxName = Dlookup("FieldName", "QueryName")
 
Top