Fill Textbox.Value with a query result.

  • Thread starter Dan Pinheiro \(Hotmail\)
  • Start date
D

Dan Pinheiro \(Hotmail\)

Hi All,
How to fill one text box or label with the results of a query? The event
I wanna use are Form Load and Click Button.
I tried to use:

Textbox.value = docmd.openquery "queryname"

or

Textbox.value = select max(date) from tablename;

I also tried to set a const, but it didn´t work.

Tks in advance.

Dan Pinheiro
Brasil
 
K

Ken Sheridan

Use a domain function to look up the value in the table:

MyTextBox = DMax("MyDateField", "MyTable")

You can add a criterion as a third argument for the DMax function if you wish.
 
Top