Current method for returning a SQL value

  • Thread starter Thread starter Phillip Armitage
  • Start date Start date
P

Phillip Armitage

I'm working on a form in which the value of a text box will be the sole
value returned by a QUERY string on a table in the same access database. The
query uses information from another text box as search criteria.

I've found that I can't use a SELECT string as a ControlSource value for the
Text box, so I'm going with VBA code.

No problem writing the SELECT string. Just need someone to quickly advise me
as to the current method for opening a connection to the current Access
database, executing the SELECT string and assigning the results to a
recordset object.

Thanks
 
Use DLookup function as the expression in the textbox's Control Source
property. See Help for more info about DLookup, which allows you to return a
single value from one field or a combination of fields from a table/query.
 
I've had similar problems trying to use an SQL statement to supply the
ControlSource value. Isn't there a way to do this? I was thinking I'm just
not getting the syntax right in the expression for the ControlSource
property. Please advise. Thanks.
 
ACCESS will not allow the use of an SQL statement as the expression in a
control's ControSource property. Use the DLookup, DSum, DMax, DMin, DCount,
etc. functions instead.
 
Back
Top