notationproblem textfield

F

feorges

Hi,
on an access2003 form , i've followed problem In a module i calculate the
age of a person. When he is less then one year i will see the months. In a
module i've made a function which works properly; in the test window i can
see the months as eg 0,03 means 3 months. when the person is older than one
year i can see the years only eg 1 or older.
on my form i use the function in a independed textfield , but the result is
always "-1" when the person is less then one year. The result of the
function is a string.
' public function(DOBdate as date,date2 as date) as string
i already changed the result of the function into a double, without success.
How can i see in my independed textfield the notation 0,03 whe the person is
three months ?

grtz, Georg
 
J

John W. Vinson

Hi,
on an access2003 form , i've followed problem In a module i calculate the
age of a person. When he is less then one year i will see the months. In a
module i've made a function which works properly; in the test window i can
see the months as eg 0,03 means 3 months. when the person is older than one
year i can see the years only eg 1 or older.
on my form i use the function in a independed textfield , but the result is
always "-1" when the person is less then one year. The result of the
function is a string.
' public function(DOBdate as date,date2 as date) as string
i already changed the result of the function into a double, without success.
How can i see in my independed textfield the notation 0,03 whe the person is
three months ?

grtz, Georg
Correct the error in the code, or in how it's used.

Please post the code, and indicate how you're referencing the function on the
form.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
F

feorges

hi,

the controlsource of the independent textfield is as followed :
=fModAge(DOBDAte,Date2)
regards Georges
 
J

John W. Vinson

hi,

the controlsource of the independent textfield is as followed :
=fModAge(DOBDAte,Date2)
regards Georges

And there are controls on the Form named DOBDAte and Date2?

Try putting them in brackets:

=fModAge([DOBDAte],[Date2])

Also be sure that the controls aren't NULL; you'll actually get a VBA error if
they are. You might want to use

public function(DOBdate as Variant,date2 as Variant) as string

since a Date variable will error if you try to give it a NULL value.

In your original post you had a ' character before the "public", which makes
the line a comment; and everything was in lower case - was that a direct copy
and paste? If so your code isn't doing what you think!
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top