Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've got a problem formatting a string that contains a date. I'm trying to set the form filter property when the error occurs, the recordsource is a query. I know it's probably something small that I'm missing, but it's not coming to me. Any help would be appreciated.


    Field: pickup__c
    Data Sample: 06/26/2009 00:00:00

    Query expression used to convert to a date:
    datevalue(mid(csvSF_Case.PICKUP__C,1,instr(csvSF_C ase.PICKUP__C," ")-1)) AS PICKUP__C

    VBA that builds filter:
    strPickupDate = "(pickup__c >= DateValue('" & Me.txtBgnPickupDate.Value & "') AND pickup__C <= DateValue('" & Me.txtEndPickupDate.Value & "'))"
    [Also tried using # sign, but didn't work either]

    Line that produces 2001 error:
    Me!sfrmManifestSummary.Form.FilterOn = True

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try

    strPickupDate = "pickup__c Between #" & Format(Me.txtBgnPickupDate, "mm/dd/yyyy") & "# And #" & Format(Me.txtEndPickupDate, "mm/dd/yyyy") & "#"

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    Try

    strPickupDate = "pickup__c Between #" & Format(Me.txtBgnPickupDate, "mm/dd/yyyy") & "# And #" & Format(Me.txtEndPickupDate, "mm/dd/yyyy") & "#"
    Hans,

    I tried that one, no luck, got the same 2001 run-time error. Any other suggestions?

    Thanks...

  4. #4
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by jmnees View Post
    Hans,

    I tried that one, no luck, got the same 2001 run-time error. Any other suggestions?

    Thanks...
    I think you need to provide all the code that is used to perform this,
    because the fragments do not provide sufficient info to determine the cause.

    It would also be useful to know where the code is being triggered from.
    Andrew

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    What Andrew says. Could you attach a stripped down and zipped copy of the database?

Posting Permissions

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