Very basic vbscript information needed for ASPMaker
- I am a 'user' rather than a 'guru' and the mission statement of this
group sounds very liberal. "" .. .. .. even the most basic of
questions are welcome .. .. .. "
This will be very basic question to most of you.
I have been using ASPMaker to generate code for my web pages that
are related to my Access database for many years. They are superb
with their support of ASPMaker problems but will not advise outside
that. The program offers users the opportunity to write functions
with vbscript code. I have read the Microsoft tutorial but I have
learned very little.
I need to write a suitable function that will add a date
to a"YearStart" field. Our year is not based on the calendar year.
The date needs to be 1st July 'next year' every year.
The 'help' pages include this:
... Codes here ...
USER_FunctionName = "your_code"
This is same as a normal VBScript function. "arglist" is optional, it
is a list of comma-separated variables representing arguments that
are passed to the function when it is called. To return your code
from the function, assign it to the function name. Any number of such
assignments can appear anywhere within the function. Remember to
return your code, if no value is assigned to the function name, the
function returns a default value: a zero-length string (""). That is,
no codes will be generated.
If I am asking the question in the wrong list I apologise. I would
appreciate advice to find the right list.
- Hi Robin,
--"I need to write a suitable function that will add a date to a"YearStart"
field. Our year is not based on the calendar year. The date needs to be 1st
July 'next year' every year."
Forget the sample you included; that's just an empty function without any
Let me see if I understand your problem:
You need to get a YEAR vaue, depending on he "current date".
If the current date lies before July 1st, then the function should return
the current year; if the date lies on or after July 1st, then the function
should return the next year, eg:
01-05-2011 should return "2011", but
01-08-2011 should return "2012".
Is this correct?
In that case, your function should be something like this:
> Function GetYearStart(MyDate)This function can be called in two ways, with or without a specific date:
> If IsNull(MyDate) Then MyDate = Date
> If Month(MyDate) < 7 Then
> GetYearStart = Year(MyDate)
> GetYearStart = Year(MyDate) + 1
> End If
> End Function
> YearStart = GetYearStart()In the first case, the MyDate argument is omitted. The function will use the
> YearStart = GetYearStart("October 19, 2011")
current system date (= the date of the CLIENT computer not the server!). In
the second case, the function will use the date you supplied as an argument.
The function returns only the YEAR part of the date, not the day or month
Hope this helps.
- BTW, may I ask why you want to use VBscript on your page?
VBscript is supported ONLY by Internet Explorer, not by any other browser,
so a VBscript page simply will not work in Firefox, Google Chrome, Opera,
Safari or Konqueror. And since IE is rapidly losing market share, it seems
Just my two cents :)
- On 6/12/2011 3:55 PM, Robin Chapple wrote:
> I am a 'user' rather than a 'guru' and the mission statement of thisAccess? Worst database ever. Barely qualifies as a database and was
> group sounds very liberal. "" .. .. .. even the most basic of
> questions are welcome .. .. .. "
> This will be very basic question to most of you.
> I have been using ASPMaker to generate code for my web pages that
> are related to my Access database for many years. They are superb
never meant for use in an environment with multiple users.
The question itself needs more information/examples before we can
accurately answer it.
Barebones CMS is a high-performance, open source content management
system for web developers operating in a team environment.
An open source CubicleSoft initiative.
Your choice of a MIT or LGPL license.