Solved

Need help with Calculated Access SQL syntax for selecting data within a certain period

Posted on 2008-06-23
4
224 Views
Last Modified: 2013-11-27
STATUS:IIF([The_Date]<= GetDate() AND IsNull([STATUS]),"Write",[STATUS])

I have a vba module with function,


or if I could get it to work just by using SQL

Function GetDate()

   dim a 

    a = weekday(now(),vbmonday)

    a = int(now())-a

    a = GetDate

End Function

Open in new window

0
Comment
Question by:7601105166084
  • 2
  • 2
4 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
your function's last line is wrong:
Function GetDate()
   dim a 
    a = weekday(now(),vbmonday)
    a = int(now())-a
    GetDate = a
End Function

Open in new window

0
 

Author Comment

by:7601105166084
Comment Utility
Sorry you are right i re-wrote the function incorrectly [only here ((-:]  but is there anything else which seems wrong.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
you might set the data type to date:
Function GetDate() as Date

   dim a 

    a = weekday(now(),vbmonday)

    a = int(now())-a

    GetDate = a

End Function

Open in new window

0
 

Author Closing Comment

by:7601105166084
Comment Utility
Thanks - i think i was using the field name too instead of an alias.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now