Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query function call

Status
Not open for further replies.

formerTexan

Programmer
Apr 10, 2004
504
0
0
US
I'm using a simple query with a function call. In the trial the function returns a constant integer value. The source table has only 1 record.

Code:
 SELECT tblRoster.RosterID, tblRoster.RosterName, tblRoster.Comments, pfRosterStatus([RosterID]) AS RosterStatus
FROM tblRoster;

the function

Code:
Public Function pfRosterStatus(lngID As Long) As Integer
    Debug.Print lngID
    pfRosterStatus = 2
End Function

1. Run the query by opening in datasheet view, it returns 1 record and makes 1 function call.

2. Set the query as a form recordsource and open the form (continuous view), I get 1 record and 2 function calls.

3. Add conditional formatting to [RosterStatus], the field displaying the function return and then open the form, I get 1 record and 4 function calls. However if I add a breakpoint to the function and step through, only 2 calls occur.

It is a stripped down, standalone form and there are no form level events. Any ideas on what is triggering the redundant function calls?

Thanks
formertexan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top