putting SQL result on a Msgbox

  • Thread starter Thread starter ali
  • Start date Start date
A

ali

I have an SQL

(Select max([date]) from Table1)

this returns the date of my latest record from Table1.
 
I have an SQL

(Select max([date]) from Table1)

this returns the date of my latest record from Table1.

---------------------------------------------------------------------------­---------
I'd like to show the result on a msgbox, meaning, when user clicks a button,
i'll launch the MsgBox and the result should be placed on the msgbox.

What should i do , dear experts ? !

I'd do it using an ADODB recordset.

dim rstData as ADODB.recordset
dim strSQL as string

strsql = "Select max([date]) AS MaxOfDate from Table1"
rstdata.open strsql

if rstdata.BOF then
msgbox "Query returned no results"
else
msgbox "The latest date is: " & rstdata("MaxOfDate")
endif

set rstdata = nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top