I have the following function.
Function Age(varBirthdat e As Variant) As Integer
'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirth date) Then Age = 0: Exit Function
varAge = DateDiff("yyyy" , varBirthdate, Now)
If Date < DateSerial(Year (Now), Month(varBirthd ate),
Day(varBirthdat e)) 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.Inta keDate)
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 4927
> Function Age(varBirthdat e As Variant, MyDate as Date) As Integer 'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirth date) Then Age = 0: Exit Function
varAge = DateDiff("yyyy" , varBirthdate, MyDate) If Date < DateSerial(Year (Now), Month(varBirthd ate), Day(varBirthdat e)) 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.r r.com... I have the following function.
Function Age(varBirthdat e As Variant) As Integer
'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirth date) Then Age = 0: Exit Function
varAge = DateDiff("yyyy" , varBirthdate, Now) If Date < DateSerial(Year (Now), Month(varBirthd ate), Day(varBirthdat e)) 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.Inta keDate)
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(varBirthdat e As Variant, MyDate as Date) As Integer
'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirth date) Then Age = 0: Exit Function
varAge = DateDiff("yyyy" , varBirthdate, MyDate) If Date < DateSerial(Year (Now), Month(varBirthd ate), Day(varBirthdat e)) 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.r r.com... I have the following function.
Function Age(varBirthdat e As Variant) As Integer
'Function from Microsoft Article Q210522
Dim varAge As Variant
If IsNull(varBirth date) Then Age = 0: Exit Function
varAge = DateDiff("yyyy" , varBirthdate, Now) If Date < DateSerial(Year (Now), Month(varBirthd ate), Day(varBirthdat e)) 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.Inta keDate)
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 code:
Sub Change(ByVal x, ByRef y)
x = x+1
y = y+1
End Sub
|
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=
fNew.writelines(lNew)
fNew.close()
|
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 when
function foo(...) (from the library) is called?
In other words, when foo() is executed, check to see if there is an
"execute me also" type of function (associated with foo) defined and if
|
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"
element.onfocus = function() {FocusIsOn = "Button_1"; alert(FocusIsOn)}
That works great. If the button gets the focus, I got a message box saying
'Button_1'.
However, if I set the variable 'FocusIsOn' dynamically (using a variable
| |
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 necessary changes on the functions and recreated
all my types and functions.
It seemd to be all right, but the newly created functions won't work
anymore.
|
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 the original name plus a
number(counter).
The problem is I have i have a div 'serials' inside 'readroot' and the
childnodes of
|
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 = somethingcomplexandcostly()
def func(a):
return simple(data,a)
|
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.
It works perfectly (assigning the correct images and the correct
onclick events to the correct <atags):
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |