Results 1 to 9 of 9

Thread: [RESOLVED] DataEnvironment Filters

  1. #1

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Resolved [RESOLVED] DataEnvironment Filters

    I believe I need to use the .Filters property of a data environment command, I need to return all records between two dates, what syntax should I use?

  2. #2
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    330

    Re: DataEnvironment Filters

    lolwut?

  3. #3

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: DataEnvironment Filters

    Nice

    Using the Filter attribute e.g.

    DataEnvironment1.rsRecordset.Filter ="blah"

    This will return the recordset with only they applicable records that pass the filter, I need to filter between two dates, what syntax should I use, is it the same as SQL, because I didn't have much luck with that.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: DataEnvironment Filters

    I would highly recommend SQL for this.

    What SQL code did you try with which you did not have much luck?

    What kind of database are you using?

  5. #5

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: DataEnvironment Filters

    Let me explain, I am using the Date Environment to interface with an Access database for a college project.

    I do not want to use SQL in that concept because my friends have easily used a filter to sort an existing recordset.

    All I need to know is what syntax to use, to make sure the [date] field is between tomorrows date, and the date a year and a day down the line.

  6. #6
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: DataEnvironment Filters

    Quote Originally Posted by I_Love_My_Vans
    Let me explain, I am using the Date Environment to interface with an Access database for a college project.

    I do not want to use SQL in that concept because my friends have easily used a filter to sort an existing recordset.

    All I need to know is what syntax to use, to make sure the [date] field is between tomorrows date, and the date a year and a day down the line.
    The filter is based on the WHERE clause concept of SQL. You'll have to learn it one way or another.

    As to your use of Filter, it's not very efficient. You end up loading first most of the records (if not all) of the table into memory before trimming it down. Bad habit to acquire.

    Lastly, the data environment is not scalable and easily becomes a white elephant in terms of updatability and maintenance.

  7. #7
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,515

    Re: DataEnvironment Filters

    This is the syntax,
    Code:
    DataEnvironment1.rsCommand1.Filter = "startdate >=  #10/1/2007# and startdate <= #10/10/2007#"
    if you are going to use variables then you have to format the string properly,
    Code:
    DataEnvironment1.rsCommand1.Filter = "startdate >=  #" & varStringdate1 & "# and startdate <= #" & varStringdate2 & "#"

  8. #8

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: DataEnvironment Filters

    Hello! Update:

    @Hack: I know SQL would be more effective etc, in this instance I did not have time to use SQL to the extent I wanted, thanks for your help regardless
    @leinad31: Same again, the Data Environment is a load of crap, not only that its ability to create reports is less than a small child, thanks for your help
    @wes4dbt: Thanks! That is the code I eventually managed to generate, thanks for your help

    Resolved!

    FYI: If you have come across this thread in a search, please use SQL, date environments suck.

  9. #9
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: [RESOLVED] DataEnvironment Filters

    Use of data environment is usually tied to the assumption that it's needed in order to use the data report. This is not so, you can use data reports bypassing design time set-up once you've learned SQL http://www.vbforums.com/showthread.php?t=433765

Posting Permissions

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



Click Here to Expand Forum to Full Width