How can I give to text box value that is sql query in access using VB code?
If I write:
Text_box_name = "select max(number) from table;"
then the text box shows me:
select max(number) from table;
instead on number.
What I do wrong?
If I use List box then the query works.
'Create a recordset object
Dim rs As Recordset
'Select value with the recordset
Set rs = CurrentDb.OpenRecordset("SELECT COUNT(*) FROM Table2")
'Put that value in the textbox
Me.txtTest = rs.Fields(0).Value
'detroy the recordset
Set rs = Nothing