Showing the last date in a table field

  • Thread starter Thread starter Neil
  • Start date Start date
N

Neil

I have a form and i want one of the text boxes to show the
last value in a column from my table.

I used the Last function in the default value of the text
box and bound the box to the column in the table (I also
tried the Max function), but no luck.

I also tried to set the value OnOpen, but that didn't work
either?

Any ideas?

Thanks

Neil
 
Hi:

Try using this SQL (Assumne data is in Table1 and there is a ID AutoNumber
field).

Select Top 1 [DateField] from [Table1] Order By [ID] Desc

You could execute this SQL on Form_Open or Form_Current and then take the
result and place in unbound control on form.

Regards,

Naresh Nichani
Microsoft Access MVP
 
Thanks for this, but when i've entered this into my code,
i get a compile error, saying "Expected: Case".

Any Ideas?

Neil

My code is:

Select Top 1 [Import_Date] from [tblImportDates] Order By
[ID] Desc

-----Original Message-----
Hi:

Try using this SQL (Assumne data is in Table1 and there is a ID AutoNumber
field).

Select Top 1 [DateField] from [Table1] Order By [ID] Desc

You could execute this SQL on Form_Open or Form_Current and then take the
result and place in unbound control on form.

Regards,

Naresh Nichani
Microsoft Access MVP




I have a form and i want one of the text boxes to show the
last value in a column from my table.

I used the Last function in the default value of the text
box and bound the box to the column in the table (I also
tried the Max function), but no luck.

I also tried to set the value OnOpen, but that didn't work
either?

Any ideas?

Thanks

Neil


.
 
Back
Top