Loading ...
Sorry, an error occurred while loading the content.

Very basic vbscript information needed for ASPMaker

Expand Messages
  • Robin Chapple
    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
    Message 1 of 4 , Jun 12, 2011
    • 0 Attachment
      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:

      ~~~~~~~~~~~~~~~~~~~~~~Start ~~~~~~~~~~~~

      Syntax:

      Function USER_FunctionName(arglist)
      ... Codes here ...
      USER_FunctionName = "your_code"
      End Function

      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.

      ~~~~~~~~~~~~~~~~~~~~~~~~End~~~~~~~~~~~~~~~~~~~~~~

      If I am asking the question in the wrong list I apologise. I would
      appreciate advice to find the right list.

      Many thanks,

      Robin Chapple
    • Bas van Hoorn
      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
      Message 2 of 4 , Jun 13, 2011
      • 0 Attachment
        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
        funcionality.

        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)
        > If IsNull(MyDate) Then MyDate = Date
        >
        > If Month(MyDate) < 7 Then
        > GetYearStart = Year(MyDate)
        > Else
        > GetYearStart = Year(MyDate) + 1
        > End If
        > End Function

        This function can be called in two ways, with or without a specific date:

        > YearStart = GetYearStart()
        > YearStart = GetYearStart("October 19, 2011")

        In the first case, the MyDate argument is omitted. The function will use the
        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
        parts.

        Hope this helps.
      • Bas van Hoorn
        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
        Message 3 of 4 , Jun 13, 2011
        • 0 Attachment
          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
          a bit pointless to use VBscript instead of JavaScript.

          Just my two cents :)
        • Thomas Hruska
          ... Access? Worst database ever. Barely qualifies as a database and was never meant for use in an environment with multiple users. VBScript? Please learn
          Message 4 of 4 , Jun 13, 2011
          • 0 Attachment
            On 6/12/2011 3:55 PM, Robin Chapple wrote:
            > 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

            Access? Worst database ever. Barely qualifies as a database and was
            never meant for use in an environment with multiple users.

            VBScript? Please learn Javascript. And you might as well learn jQuery
            too, which is the best thing to ever happen to Javascript.

            The question itself needs more information/examples before we can
            accurately answer it.

            --
            Thomas Hruska
            CubicleSoft President

            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.

            http://barebonescms.com/
          Your message has been successfully submitted and would be delivered to recipients shortly.