[AccessD] Automating parameterized action queries.....DATE?!

Sad Der accessd666 at yahoo.com
Mon Mar 14 00:57:56 CST 2005


Ken,

thnx again...but I found out why it didn't return
anything. A real DOH! moment :-)
Here's the code from my class:
      If Not dtmNewBusinessDate = "00:00:00" Then
            mdtmNewBusinessDate = dtmNewBusinessDate
         End If
      Else
         NewBusinessDate = mdtmNewBusinessDate
      End If

The IF NOT statement should always be true. So the
code in the IF THEN statement is always executed...but
then it doesn't return the value!!!!! it only does it
in the ELSE part. DOH!

Thnx.

Btw I cannot use the Public oRptParam As NEW
cReportParams line. Because it is possible that
multiple reports are run within the same instance of a
form...meaning that the object isn't destroyed and the
last value is automagicly used.

Regards,

Sander
--- Ken Ismert <KIsmert at TexasSystems.com> wrote:

> 
> Sander:
> 
> Your problem is with your date delimiters: use
> #00:00:00# instead of
> "00:00:00". This, by the way, is Microsoft Day 0,
> which is 12/30/1899.
> 
> You will have to change this segment of your code,
> as well:
>    dtmNewBusinessDate = InputBox("Enter the new
> business date:")
> 
> You will need something like:
>    Dim sNewDate As String
>    sNewDate = InputBox("Enter the new business
> date:")
>    If IsDate(sNewDate) Then
>       mdtmNewBusinessDate = CDate(sNewDate)
>    End If
> 
> Also, a suggestion:
> 
> If you use:
>    Public oRptParam As NEW cReportParams
> 
> Then you can get rid of this business in your
> functions:
>    If oRptParam Is Nothing Then
>       Set oRptParam = New cReportParams
>       blnDestroyRepParam = True
>    Else
>       blnDestroyRepParam = False
>    End If
>    ...
>    If blnDestroyRepParam Then
>       Set oRptParam = Nothing
>    End If
> 
> The New keyword sets oRptParam to a new instance of
> cReportParams
> automatically on first reference. A single instance
> of the object will
> remain active until you exit or set it to nothing.
> This seems to be a good
> fit for your code here. I have used this technique
> for years in many Access
> programs with no ill effects. It is a documented and
> valid part of the VBA
> spec, and it has a place in your toolbox.
> 
> -Ken
> 
> Property Get NewBusinessDate() As Variant
>    Dim dtmNewBusinessDate As Date
> 
>    If mFormDriven Then
>       NewBusinessDate = mdtmNewBusinessDate
>    Else
>       If mdtmNewBusinessDate = "00:00:00" Then
> 'I fill the InputBox with the value 22/02/2005
>          dtmNewBusinessDate = InputBox("Enter the
> new
> business date:")
>          If Not dtmNewBusinessDate = "00:00:00" Then
>             mdtmNewBusinessDate = dtmNewBusinessDate
>          End If
>       Else
>          NewBusinessDate = mdtmNewBusinessDate
>       End If
>    End If
> End Property



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 



More information about the AccessD mailing list