Mwa Hahahaa Success At Last.. Almost

Sep 9, 2004

These are the two functions I am using to calculate Years and Months that have passed since a specific date. It works. Its amazing.

Its a pain.

If the field that passes the value is empty, I get #Error in the field that calls these functions. Ive tried error correcting, but I still have the #Error showing.

Any help would be much appreciated.



'************************************************* ************
' FUNCTION NAME: Age()
'
' PURPOSE:
' Calculates age in years from a specified date to today's date.
'
' INPUT PARAMETERS:
' StartDate: The beginning date (for example, a birth date).
'
' RETURN
' Age in years.
'
'************************************************* ************
Function Age(varBirthDate As Variant) As Integer
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



'************************************************* ************
' FUNCTION NAME: AgeMonths()
'
' PURPOSE:
' Compliments the Age() function by calculating the number of months
' that have expired since the last month supplied by the specified date.
' If the specified date is a birthday, the function returns the number of
' months since the last birthday.
'
' INPUT PARAMETERS:
' StartDate: The beginning date (for example, a birthday).
'
' RETURN
' Months since the last birthday.
'************************************************* ************
Function AgeMonths(ByVal startDate As String) As Integer

Dim tAge As Integer
If IsNull(startDate) Then AgeMonths() = 0: Exit Function


tAge = (DateDiff("m", startDate, Now))


If (DatePart("d", startDate) > DatePart("d", Now)) Then
tAge = tAge - 1
End If
If tAge < 0 Then
tAge = tAge + 1
End If

AgeMonths = CInt(tAge Mod 12)



End Function

View Replies


ADVERTISEMENT

Victim Of It's Own Success; Upsizing Question

Mar 20, 2006

Hi,

I have developed a couple of database applications. This started as a small thing but now is growing to the point where I've got to make some decisions and would appreciate some guidance.

Presently:

Front end: 4 Different GUI's as local front ends.
Back end: Intranet network share on Win2k desktop (limited by O/S to 10 connections at one time)

Going forward, about 30 users will have access to the front ends and will all need concurrent access to the back end data. At some point, I would like to generate web pages from the data in the back end database and have the back end machine also be the web server for this.

So, what are my "best" options for the back end?
I was thinking of getting Win 2k3 Server running SQL server to drive the database.

The ability to integrate security with existing infrastructure would definitely be a plus, which I believe Win 2k3 can do.

I don't know very much about Win 2k3 or SQL server, but am willing to invest in learning the ins and outs as long as I can get it up and running with the same functionality I have now (with relative ease) and scale it as my capabilities with the OS and SQL server increase.

To be honest though, I am a little scared about how much I'll have to change my existing applications in order to make it work.

Your suggestions, comments, experiences most welcome and valued.

Thanks,

Al

View 1 Replies View Related

Without Any Success To Build A Small Stock Control Database.

Feb 15, 2008

Hi

I am trying without any success to build a small stock control database.

very simply put I am the main site and I have many other sites. each site has a unique code. I have 4 products only. I want to have the total stock that I hold in my site and as I send stock to other sites I want the number to decrease from my site and be added to the other specified site.

any ideas anyone.

View 3 Replies View Related

Forms :: Rename Two Forms But With No Success

Jun 5, 2013

I have a database with a vast number of forms. I need to rename two forms but with no success. Once I rename the form, it just jumbs back to it's original name.I cannot save these files as well.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved