VB Functions in Access Module

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Re: VB Functions in Access Module

    "Sean S" <sespark@webprod.net> wrote in message
    news:00bf01c37257$4b9c1fb0$3501280a@phx.gbl...
    > I am using a Access query to select a list of information
    > from a table. I use function defined in a vb module in
    > the Access database. The function is called in the query
    > which is written in the database. The query is called
    > qryAction and is as follows:
    > PARAMETERS ID Short, Appointment1 Short, DueDateI
    > DateTime, Employee Short;
    > SELECT Action.*, DerivedDate
    > (Action.Month,Action.Day,Action.Minute,Appointment .Meeting
    > Time,Action.Prior) AS DueDate
    > FROM ((Client RIGHT JOIN Matter ON Client.ClientID =
    > Matter.ClientID) RIGHT JOIN Retainer ON Matter.MatterID =
    > Retainer.MatterID) RIGHT JOIN (Appointment RIGHT JOIN
    > [Action] ON Appointment.AppointmentID =
    > Action.AppointmentID) ON Retainer.RetainerID =
    > Action.RetainerID
    > WHERE blah;
    >
    > DerivedDate is said function and is as follows:
    > Function DerivedDate(ByVal numMonth As Integer, ByVal
    > numDay As Integer, ByVal numMinute As Integer, ByVal
    > dateOriginal As Date, ByVal boolPrior As Boolean) As Date
    > Dim dateNew, floatPrior
    > If boolPrior Then
    > floatPrior = -1
    > Else
    > floatPrior = 1
    > End If
    > dateNew = dateOriginal
    > numMonth = numMonth * floatPrior
    > numDay = numDay * floatPrior
    > numMinute = numMinute * floatPrior
    > dateNew = DateAdd("m", numMonth, dateNew)
    > dateNew = DateAdd("y", numDay, dateNew)
    > dateNew = DateAdd("n", numMinute, dateNew)
    > DerivedDate = dateNew
    > End Function
    SELECT
    Action.*,
    DateAdd("m",IIF(Action.Prior,0-Action.Month,Action.Month),
    DateAdd("y",IIF(Action.Prior,0-Action.Day,Action.Day),
    DateAdd("n",IIF(Action.Prior,0-Action.Minute,Action.Minute),Appointment.
    Meeting))) AS DueDate
    FROM
    ..
    ..
    ..

    Notes:
    1. When possible, please avoid the use of "SELECT *". Here's an article
    on why: [url]http://aspfaq.com/2096[/url]
    2. Consider redesigning the Action table as the values for
    Month,Day,Minute and Prior can and should be represented in a datetime
    value.

    HTH
    -Chris


    Chris Hohmann Guest

  2. Similar Questions and Discussions

    1. Access Module
      In searching through all of the linux install/update packages for FMS2, I cannot find examples in any of them of an Access module, as outlined in...
    2. Access a c++ module from Perl
      I am using cygwin and perl and trying to access some function from a C++ windows dll. After the first attempt produced a segmentation fault, I tried...
    3. new module Logfile::Access
      I just uploaded my first perl module, Logfile::Access. Makes parsing access logs very easy. ...
    4. Unable to access public functions of the objects used as parameters of the web service.
      I have a web method as follows: Public Function SearchDocument(ByVal UserLogonName As String, ByVal BusinessName As String,ByVal SearchData As...
    5. SQL Server - Alternate for First() Last() functions available in MS Access
      Hi, I am trying to find out an alternate way to implement the First() & Last() functions (MS Access) in the SQL SELECT statement of SQL Server. ...
  3. #2

    Default Re: VB Functions in Access Module

    Due to security reasons, you cannot run queries that call custom VBA
    functions from external programs: Access must be running in order for them
    to run. We've been cursing about this for years, but the security argument
    does tend to quell those grumbles.

    In addition to custom VBA functions, several builtin VBA functions cannot be
    called in jet queries as well.This page contains the list of VBA builtin
    functions that can be used in Jet queries run from external applications
    such as VB and ASP:
    [url]http://support.microsoft.com/default.aspx?scid=kb;en-us;239482[/url]

    You are going to have to come up with another way to implement the
    functionality of the DerivedDate function.

    HTH,
    Bob Barrows

    Sean S wrote:
    > I am using a Access query to select a list of information
    > from a table. I use function defined in a vb module in
    > the Access database. The function is called in the query
    > which is written in the database. The query is called
    > qryAction and is as follows:

    Bob Barrows Guest

  4. #3

    Default Re: VB Functions in Access Module

    Thank you very much for your quick reply. :D That's too
    bad. :(
    >-----Original Message-----
    >Due to security reasons, you cannot run queries that
    call custom VBA
    >functions from external programs: Access must be running
    in order for them
    >to run. We've been cursing about this for years, but the
    security argument
    >does tend to quell those grumbles.
    >
    >In addition to custom VBA functions, several builtin VBA
    functions cannot be
    >called in jet queries as well.This page contains the
    list of VBA builtin
    >functions that can be used in Jet queries run from
    external applications
    >such as VB and ASP:
    >[url]http://support.microsoft.com/default.aspx?scid=kb;en-[/url]
    us;239482
    >
    >You are going to have to come up with another way to
    implement the
    >functionality of the DerivedDate function.
    >
    >HTH,
    >Bob Barrows
    >
    >Sean S wrote:
    >> I am using a Access query to select a list of
    information
    >> from a table. I use function defined in a vb module in
    >> the Access database. The function is called in the
    query
    >> which is written in the database. The query is called
    >> qryAction and is as follows:
    >
    >
    >.
    >
    Sean S Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139