Hi...I have tblClient table and a tblValuationData, the tables are linked by Policy number. Each client has several lines of valuation data, categorised by either cash accounts or fund holdings. I have a report with record source tblClient, this report has 2 sub reports with recordsource tble ValuationData detailing the current cash account values and the fund holding values. I can produce a pdf of the report and attach to an email.
What I'd like to do is produce a run of valuations, which I think can be done by looping through the records....
I have used the code below from a previous thread explaining recordsets, and when run it produces a list of all the relevant policy numbers,,,,could anyone help me with the next steps producing a run of valuations using the data contained in the 2 tables? or recommend a better solution ....any help much appreciated....thanks
Fi
Option Compare Database
Sub DAOexample1()
On Error GoTo ErrorHandler
Dim strSQL As String
Dim rs As DAO.Recordset
strSQL = "tblClient"
Set rs = CurrentDb.OpenRecordset(strSQL)
With rs
If Not .BOF And Not .EOF Then
.MoveLast
.MoveFirst
While (Not .EOF)
Debug.Print rs.Fields("ID") & " " & rs.Fields("Policy No")
.MoveNext
Wend
End If
.Close
End With
ExitSub:
Set rs = Nothing
Exit Sub
ErrorHandler:
Resume ExitSub
End Sub
What I'd like to do is produce a run of valuations, which I think can be done by looping through the records....
I have used the code below from a previous thread explaining recordsets, and when run it produces a list of all the relevant policy numbers,,,,could anyone help me with the next steps producing a run of valuations using the data contained in the 2 tables? or recommend a better solution ....any help much appreciated....thanks
Fi
Option Compare Database
Sub DAOexample1()
On Error GoTo ErrorHandler
Dim strSQL As String
Dim rs As DAO.Recordset
strSQL = "tblClient"
Set rs = CurrentDb.OpenRecordset(strSQL)
With rs
If Not .BOF And Not .EOF Then
.MoveLast
.MoveFirst
While (Not .EOF)
Debug.Print rs.Fields("ID") & " " & rs.Fields("Policy No")
.MoveNext
Wend
End If
.Close
End With
ExitSub:
Set rs = Nothing
Exit Sub
ErrorHandler:
Resume ExitSub
End Sub