Event Procedure

Local time
Tomorrow, 00:17
Joined
Jul 12, 2006
Messages
70
In one of my forms, i have this event procedure:

Private Sub Gross_Com_LostFocus()
If Gross_Com.Value >= 1000 Then
Full_Com.Value = [Gross_Com] * 0.2
Else
Full_Com.Value = 0
End If
End Sub

Is it possible to put such code in a report and query? If so, how?

Thanks a million!

Cheers!
Sheila
 
First, you don't need the .value qualifier in Access

Here's one easy way

assuming you are using the Access query designner,

drag the field [gross_com] to your query

In another column header type

Full_com: iif(nz(gross_com,0)>=1000,gross_com*0.2,0)

now you can use gross_com or full_com in any report.

the statement to the right of the = sign is an immediate if statement.
the nz sets gross_com to zero if it happens to be blank, to avoid calculation fummies. the inside of the iif is

iif(test condition,answer if TRUE, answer if FALSE)

This is one easy way, but generally iif statements are not as efficient as some other methods of coding.
 
Thanks a million! It works!

Sheila
 

Users who are viewing this thread

Back
Top Bottom