Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Aug 2006
    Location
    Gtr London, England
    Posts
    256
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Specific Data fr Access (VBA - Excel 2003)

    Hi,

    Im having problems amending a script which pulls data from Access. I need to exclude data where the beginning of the file number is CHE0034. Ive tried varies ways but keep getting error messages. The script line concerned is listed below, my experience it rather limited, no doubt, hopefully, someone could have a quick look and let me know where Im going wrong please.

    Set rst = dbs.OpenRecordset("SELECT [Completion Date],[FileNo] FROM qryCGSetupDates WHERE [Completion Date] >= Date(),[FileNo]<> '"CHE0034*"' ")

    Many thanks in advance for any suggestions.

    Cheers.
    Lee

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

    Re: Specific Data fr Access (VBA - Excel 2003)

    Try
    <code>
    Set rst = dbs.OpenRecordset("SELECT [Completion Date],[FileNo] FROM qryCGSetupDates WHERE [Completion Date] >= Date() AND [FileNo] Not Like 'CHE0034*'")
    </code>
    If you have multiple conditions, you combine them using AND (or OR, if applicable).
    If you want to compare to a string with wildcards, you must use Like or Not Like.

  3. #3
    3 Star Lounger
    Join Date
    Aug 2006
    Location
    Gtr London, England
    Posts
    256
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Specific Data fr Access (VBA - Excel 2003)

    Great, many thanks for your help Hans.

    Cheers.
    Lee

Posting Permissions

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