i have a subforme with a column called Price. The values in this column are calculated via a dlookup formula. i would like to calculate the total of the price column but i do not now how can some one please help. thank you
There may be a faster way that someone else may know of, but I know one way that has worked for me:
On Error GoTo ErrorHandler
Dim frm As Form
Dim subfrm As Control
Dim rst As DAO.Recordset
Dim curTotal As Currency
Set mainfrm = Forms!frmMainName
Set subfrm = mainfrm!frmSubName
Set rst = subfrm.Form.RecordsetClone
'cycle through rst and calc total
curTotal = 0
While Not rst.EOF
curTotal = curTotal + Nz(rst!Price, 0)
' do whatever with curTotal
Set rst = Nothing
On Error Resume Next
Just be sure to name the variables according to your situation.
the aim is store once, not store multiple times
Remember... Optimize 'til you die!
Progaming environment: Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010 VB based on my own environment: vb6 sp5 ASP based on my own environment: 5.6 VB-NET based on my own environment started 2007 SQL-2005 based on my own environment started 2008 MYLE YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.