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!

calling a function from control source of text box

Status
Not open for further replies.

jimlee

Programmer
Jan 27, 2001
213
0
0
GB
Hi, can anyone help me with this?

I have a form for data entry and one of the text box fields has a control source of
"=ActiveClientCount([ID])"...this refers to a function which returns an integer value and uses the ID field of the form as it's parameter (this is an autonumber field).

My problem is twofold:

1) As this is a data entry form, the ID field is null when the form is first opened and thus the text box shows the error "#Number" which looks untidy.

2) The function is referred to in the control source property of the text box, so how do I then bind this to the underlying table?

I could probably 'get round' these two problems but i'd like to know if there are actual text book ways of doing it first as my boss will probably look at this when it's finished!!

any help much appreciated


jimlad
 
For your second problem, you could hide a bound textbox on your form (txt.Visible = False) and assign it the value in the original text box.

 
How about....

=iif(isnull(IDField),"",ActiveClientCount([ID]))


Randy
 
Both problems now fixed, thanks very much for your help

jimlad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top