[AccessD] A2K Reference the dot column property in a query

Stuart Sanders stuart at pacific.net.hk
Mon Oct 20 02:37:07 CDT 2003


Yes ... You can't set variables declared as LONG/INTEGER/STRING etc as null.  Ie
  DIM lngi as LONG
  Lngi = NULL
This won't work ... It will generate an error.  You can only do that with
variants.  I usually try to avoid variants, so would use something like this:

STATIC FUNCTION StartDate(OPTIONAL dteStartDate as Date = 0) as Date
  Local dteStore as Date
  IF dteStartDate <> 0 Then
    dteStore = dteStartDate
  END IF
  StartDate = dteStore
End FUNCTION

Of course this assumes that 00:00:00 Jan 1 1890 (or whenever the start value of
the date variable is) is not going to be a valid input.  

In some circumstances I add initialisation options.

Stuart

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Colby
> Sent: Monday, 20 October, 2003 3:16 PM
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] A2K Reference the dot column property 
> in a query
> 
> 
> Arthur,
> 
> The only way I was able to get this working was using an 
> optional VARIANT
> and checking IsMissing.  IsNull didn't work on a missing integer.
> 
> Static Function FltrSfrmClaimAssociatesCboContactSelFilter(Optional
> llngCTYID As Variant)
> Dim lngCTYID As Variant
>     If Not IsMissing(llngCTYID) Then
>         lngCTYID = llngCTYID
>     End If
>     FltrSfrmClaimAssociatesCboContactSelFilter = lngCTYID
> End Function
> 
> It does work great though.  Set it up to be called in 
> AfterUpdate of the
> filter combo and used the function value in the dependent 
> combo's query.
> 
> John W. Colby
> www.colbyconsulting.com
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of 
> Arthur Fuller
> Sent: Saturday, September 06, 2003 2:49 PM
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] A2K Reference the dot column property 
> in a query
> 
> 
> Thanks for the explication, Stuart!
> 
> IMO the coolest thing about statics is that you can eliminate 
> references to
> forms. In the AfterUpdate event of some control, you call the static
> function and pass the param. Anywhere else you need it, call the func
> without a param. I don't like being tied to particular forms 
> being open. I
> want to be able to run a query etc. from the debug window 
> anytime I want,
> and to set said static func from the debug window anytime I 
> want. Statics
> give me this. That's why I love 'em.
> 
> A.
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of 
> Rocky Smolin -
> Beach Access Software
> Sent: Saturday, September 06, 2003 8:23 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] A2K Reference the dot column property 
> in a query
> 
> 
> Oh.  That's very cool.
> 
> Rocky
> 
> ----- Original Message -----
> From: "Stuart McLachlan" <stuart at lexacorp.com.pg>
> To: "Access Developers discussion and problem solving"
> <accessd at databaseadvisors.com>
> Sent: Friday, September 05, 2003 5:40 PM
> Subject: Re: [AccessD] A2K Reference the dot column property 
> in a query
> 
> 
> > On 5 Sep 2003 at 7:48, Rocky Smolin - Beach Access S wrote:
> >
> > > Must have missed that thread Arthur.  What are static functions?
> > >
> >
> >
> > Functions which retain the value of their variables between calls.
> > Something like:
> >
> > STATIC FUNCTION StartDate(OPTIONAL dteStartDate as Date) as Date
> > Local dteStore as Date
> > IF NOT ISNULLl(dteStartDate) Then
> >      dteStore = dteStartDate
> > END IF
> > StartDate = dteStore
> > End FUNCTION
> >
> > Every time you call the function with a date parameter, it sets its
> > value. Every time you call it without a parameter, it returns the
> > last value set.
> >
> > You can now  you user select a start date on a "pick form" 
> somewhere.
> > When they have picked it, set the value of  Startdate() with
> > something like dteTemp = StartDate(txtStartDate)
> >
> > Now you can use "=StartDate()" in reports, queries, form filters etc
> > anywhere you like. It will return the selected value  until the user
> > goes back to the pick form and changes it.
> >
> >
> >
> > --
> > Lexacorp Ltd
> > http://www.lexacorp.com.pg
> > Information Technology Consultancy, Software 
> Development,System Support.
> >
> >
> >
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.510 / Virus Database: 307 - Release Date: 8/14/2003
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.510 / Virus Database: 307 - Release Date: 8/14/2003
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> 
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 


More information about the AccessD mailing list