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.
"CuriousMark" wrote in message news:5E7C8E57-4965-4987-AA5B-0C1E138F2304@microsoft.com... > 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")
Thanks. That's perfect! "Stuart McCall" wrote: > "CuriousMark" wrote in message > news:5E7C8E57-4965-4987-AA5B-0C1E138F2304@microsoft.com... > > 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") > > >