/ Published in: Visual Basic

This method runs a SQL query and returns the first result (the query is expected to return exactly one record and one field).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Private Function getResultFromSQL(sql As String) As Variant Dim recordset As recordset Set recordset = CurrentDb.OpenRecordset(sql) If (Not recordset.EOF) _ And (Not recordset.BOF) Then recordset.MoveFirst getResultFromSQL = recordset(0) Set recordset = Nothing Exit Function End If Set recordset = Nothing getResultFromSQL = Nothing End Function
Comments
