problem with requeries in form

krowe

Registered User.
Local time
Today, 05:45
Joined
Mar 29, 2011
Messages
159
Hi

I have a form that I need to update whenever a value is changed but i seem to be getting some errors.

the 2 problems are the dsum at the bottom do not seem to work consistently.

Also if the user clicks the pcm box after putting an amount in but prior to selecteing a frequency, an error comes up. (i'd like to disbale this box but still show it if that is possible)

Can anybody help with either of these things?

the main form is frmFinancialStatement


Thanks
 

Attachments

Hi,

Change qryIncome2010 to:

Code:
SELECT tblIncome2010.IncomeID, tblIncome2010.ID, tblIncome2010.Type, tblIncome2010.Amount, tblIncome2010.Frequency, tblIncome2010.Notes, iif(not isnull([Frequency]) and not isnull([amount]),(DLookUp("Multiplier","tblFreq","FreqID = " & [Frequency]))*[Amount]/12,null) AS pcm, iif(not isnull([Frequency]) and not isnull([amount]),Format((DLookUp("Multiplier","tblFreq","FreqID = " & [Frequency]))*[Amount]/12,"Currency"),null) AS pcm2
FROM tblIncome2010;

qryExpenditure2010 to:

Code:
SELECT tblExpenditure2010.ExpenditureID, tblExpenditure2010.ID, tblExpenditure2010.Type, tblExpenditure2010.Amount, tblExpenditure2010.Frequency, tblExpenditure2010.Notes, iif(not isnull([Frequency]) and not isnull([amount]),(DLookUp("Multiplier","tblFreq","FreqID = " & [Frequency]))*[Amount]/12,null) AS pcm, iif(not isnull([Frequency]) and not isnull([amount]),Format((DLookUp("Multiplier","tblFreq","FreqID = " & [Frequency]))*[Amount]/12,"Currency"),null) AS pcm2
FROM tblExpenditure2010;

the vba on sfrmIncome2010 to:

Code:
Option Compare Database
Option Explicit
Private Sub Amount_AfterUpdate()
If Not IsNull(Me.Amount) And Not IsNull(Me.Frequency) Then
DoCmd.Save
Me.Parent!IncomeTotal.Requery
Me.Parent!Surplus.Requery
End If
End Sub
Private Sub Frequency_AfterUpdate()
If Not IsNull(Me.Amount) And Not IsNull(Me.Frequency) Then
DoCmd.Save
Me.Parent!IncomeTotal.Requery
Me.Parent!Surplus.Requery
End If
End Sub

and the vba code on sfrmExpenditure2010 to:

Code:
Option Compare Database
Option Explicit
Private Sub Amount_AfterUpdate()
If Not IsNull(Me.Amount) And Not IsNull(Me.Frequency) Then
DoCmd.Save
Me.Parent![ExpenditureTotal].Requery
Me.Parent!Surplus.Requery
End If
End Sub
Private Sub Frequency_AfterUpdate()
If Not IsNull(Me.Amount) And Not IsNull(Me.Frequency) Then
DoCmd.Save
Me.Parent![ExpenditureTotal].Requery
Me.Parent!Surplus.Requery
End If
End Sub

!~)
 
Thats working much smoother now

Thank you very much,

There's the difference between 'knowing what to' do and 'knowing what you're doing'
 

Users who are viewing this thread

Back
Top Bottom