Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Mar 2005
    Leicestershire, United Kingdom
    Thanked 0 Times in 0 Posts

    Module in a query (2000)

    I am trying to pass a date in a query via a module so that formats it correctly. The code in the query is

    Withdraw: withdrawdate([tblProperty]![withdrawDate])

    The code behind withdraw date in the module is:

    Dim s1 As String
    Dim s2 As String
    Dim s3 As String
    Dim d As Integer
    If IsNull(varDate) Then
    WithdrawDate = Null
    ElseIf Not IsDate(varDate) Then
    WithdrawDate = Null
    d = Day(varDate)
    s1 = Format(varDate, "d")
    Select Case d
    Case 1, 21, 31
    s2 = "st"
    Case 2, 22
    s2 = "nd"
    Case 3, 23
    s2 = "rd"
    Case Else
    s2 = "th"
    End Select
    s3 = " " & Format(varDate, "mmmm yyyy")
    WithdrawDate = s1 & s2 & s3
    End If

    The field withdraw belongs to tblproperty
    Best Regards,


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: Module in a query (2000)

    Did you have a question? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    I would give the function a different name - having a field and a function with the same name can easily lead to confusion.
    And I'd use . instead of ! in the expression.

Posting Permissions

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