All I want to do is run a simple SQL code on an onclick event procedure. I want the SQL to get the max value in a field and then I want it to appear in my message box. Sounds easy but I am stupid, so if anyone could look at my code and tell me what i am doing wrong, it would be a great help!
Here is the part of my code I am having issues with:
Dim strMaxNum As String
Dim dbs As Database
Dim strSQL As String
Dim rst As Recordset
Set dbs = CurrentDb
strSQL = "SELECT Max([FMS Cycle Raw Data].file_suffix) AS MaxNum FROM [FMS Cycle Raw Data];"
Set rst = dbs.OpenRecordset(strSQL)
strMaxNum = rst(MaxNum)
MsgBox strMaxNum
PS. Since this site is very slow, feel free to e-mail me directly @: gblackiv@hotmail.com
Thanks,
Gary
Here is the part of my code I am having issues with:
Dim strMaxNum As String
Dim dbs As Database
Dim strSQL As String
Dim rst As Recordset
Set dbs = CurrentDb
strSQL = "SELECT Max([FMS Cycle Raw Data].file_suffix) AS MaxNum FROM [FMS Cycle Raw Data];"
Set rst = dbs.OpenRecordset(strSQL)
strMaxNum = rst(MaxNum)
MsgBox strMaxNum
PS. Since this site is very slow, feel free to e-mail me directly @: gblackiv@hotmail.com
Thanks,
Gary