If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Date filtering with macros

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-26-11, 06:19
clownyj clownyj is offline
Registered User
 
Join Date: Jun 2011
Posts: 31
Date filtering with macros

I have a condition from a query that i would like to apply to a raw data table using a macro. The condition within the query for a date field is

Between ([forms]![RADScreen]![StartDate]) And ([forms]![RADScreen]![EndDate])

I even copied the SQL for that particular field and tried pasting it into the where condition for 'ApplyFilter', but the results are not filtered between the selected dates from the form.
SQL:
(([ALL SAMPLE DATA].BOOKDATE) Between ([forms]![RADScreen]![StartDate]) And ([forms]![RADScreen]![EndDate]))

Any ideas what i may be doing wrong and how to go around this?
Reply With Quote
  #2 (permalink)  
Old 07-29-11, 13:42
apr pillai apr pillai is offline
Registered User
 
Join Date: Jan 2009
Location: Kerala, India
Posts: 107
Set the Filter On Load Property value of the Table to Yes and keep the RADScreen open with the Date-Range values in StartDate and EndDate controls before opening the Table.

If the Table is the Record Source of RADScreen then the Filter Macro must be assigned to the On Open Event Property. If that is the case then it will not work because after opening the form only you will be able to set the StartDate and EndDate control values.
__________________
http://www.msaccesstips.com (Learn MS-Access Tips & Tricks)
Learn Advanced MS-Access Programming with sample VBA Code.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On