I have the following function.
Function Age(varBirthdate As Variant) As Integer
'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirthdate) Then Age = 0: Exit Function
varAge = DateDiff("yyyy", varBirthdate, Now)
If Date < DateSerial(Year(Now), Month(varBirthdate),
Day(varBirthdate)) Then
varAge = varAge - 1
End If
Age = CInt(varAge)
End Function
I would like to modify it to calculate the Age of a person from the date
he entered the program so I rewrote one of the lines to this
varAge = DateDiff("yyyy", varBirthdate, tblClients.IntakeDate)
I receive a Compile Error: Fucntion call on left-hand side of assignment
must return Variant or Object.
I would like to know what I am doing wrong and how to correct it.
Thank you,
Deborah 2 4919
> Function Age(varBirthdate As Variant, MyDate as Date) As Integer 'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirthdate) Then Age = 0: Exit Function
varAge = DateDiff("yyyy", varBirthdate, MyDate) If Date < DateSerial(Year(Now), Month(varBirthdate), Day(varBirthdate)) Then varAge = varAge - 1 End If
Age = CInt(varAge)
End Function
Then you have to pass the value to the function, in the Design Grid:
QueryField: Age([BirthDate], [MyDate])
P
"Deborah V. Gardner" <dg******@twcny.rr.com> wrote in message
news:3F***************@twcny.rr.com... I have the following function.
Function Age(varBirthdate As Variant) As Integer
'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirthdate) Then Age = 0: Exit Function
varAge = DateDiff("yyyy", varBirthdate, Now) If Date < DateSerial(Year(Now), Month(varBirthdate), Day(varBirthdate)) Then varAge = varAge - 1 End If
Age = CInt(varAge)
End Function
I would like to modify it to calculate the Age of a person from the date he entered the program so I rewrote one of the lines to this
varAge = DateDiff("yyyy", varBirthdate, tblClients.IntakeDate)
I receive a Compile Error: Fucntion call on left-hand side of assignment must return Variant or Object.
I would like to know what I am doing wrong and how to correct it.
Thank you, Deborah
Phobos
Thank you. It worked!
Deborah
Phobos wrote: Function Age(varBirthdate As Variant, MyDate as Date) As Integer
'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirthdate) Then Age = 0: Exit Function
varAge = DateDiff("yyyy", varBirthdate, MyDate) If Date < DateSerial(Year(Now), Month(varBirthdate), Day(varBirthdate)) Then varAge = varAge - 1 End If
Age = CInt(varAge)
End Function
Then you have to pass the value to the function, in the Design Grid:
QueryField: Age([BirthDate], [MyDate])
P
"Deborah V. Gardner" <dg******@twcny.rr.com> wrote in message news:3F***************@twcny.rr.com... I have the following function.
Function Age(varBirthdate As Variant) As Integer
'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirthdate) Then Age = 0: Exit Function
varAge = DateDiff("yyyy", varBirthdate, Now) If Date < DateSerial(Year(Now), Month(varBirthdate), Day(varBirthdate)) Then varAge = varAge - 1 End If
Age = CInt(varAge)
End Function
I would like to modify it to calculate the Age of a person from the date he entered the program so I rewrote one of the lines to this
varAge = DateDiff("yyyy", varBirthdate, tblClients.IntakeDate)
I receive a Compile Error: Fucntion call on left-hand side of assignment must return Variant or Object.
I would like to know what I am doing wrong and how to correct it.
Thank you, Deborah This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul Paterson |
last post by:
I am trying to find a way to mimic by-reference argument passing for
immutables in Python. I need to do this because I am writing an
automated VB to Python converter.
Here's an example of the VB...
|
by: qwweeeit |
last post by:
Hi all,
when I was young I programmed in an interpreted language that allowed
to modify itself.
Also Python can (writing and running a module, in-line):
fNew =open("newModule.py",'w')
lNew=...
|
by: Jason Heyes |
last post by:
Look at my code:
void modify_element(BigType &x)
{
/* not shown */
}
BigType modify_element_copy(BigType x)
{
modify_element(x);
|
by: VA |
last post by:
I am using a JS library of functions that I include in my web page
using the usual
<script type="text/javascript" src=...>
method
Is there a way to automatically call one of my own functions...
|
by: Stefan Mueller |
last post by:
I'd like to set a variable called 'FocusIsOn' if a button got the focus.
Because my button is dynamically created I do it like
xelement = document.createElement("input")
xelement.type = "button"...
| |
by: Együd Csaba |
last post by:
Hi,
I've a problem with some of my stored procs. My config is: RH7.1, Postgres
7.3.2
I had converted a few fields of a few tables from one type to another and
after this I made all the...
|
by: chuck |
last post by:
Hi,
I am modifying some code from here
http://www.quirksmode.org/dom/domform.html
I have a div 'readroot' that I clone. I change the change the id and
name of the childnodes of 'readroot' to...
|
by: Robin Becker |
last post by:
When young I was warned repeatedly by more knowledgeable folk that self
modifying code was dangerous.
Is the following idiom dangerous or unpythonic?
def func(a):
global func, data
data =...
|
by: GaryB |
last post by:
Hi Guys,
I've been battling with this one for hours - I hope that you can help
me!
My code modifies the <aon a page, from a standard document link into
a link with a tailored onclick event.
...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |