Hello all,
I am tearing my hair out over what should be a very simple task. I am a php developer and find access quite frustrating.
All I want to do is to use an SQL query to find the sum of a field for all records in another table. Then take that figure and display it in a caption on my form. It should be simple and I'm sure it is but i'm struggling to find a solution, either because it is so simple or because I do not know the correct terminology to google for.
the following code gets me the total number of recored, but i want to add up the values of 'assetvalue'
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim intResult As Integer
Dim strSQL As String
Set db = CurrentDb
strSQL = "SELECT SUM(assetvalue) As RecordCount FROM dbAssets"
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
intResult = rs("RecordCount")
rs.Close
db.Close
Me.assets_j = intResult
Any help much appreciated.