Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Access 2003 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2003 VBA Programmer's Reference by Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein; ISBN: 9780764559037
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2003 VBA Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 6th, 2007, 02:11 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Concatenated dynamic date

Help! I'm an oracle dba, modifying access .mdb queries. The last programmer had the criteria for data selection as

      between Date() and #01/01/2006#

The end result needs to be getting the totals between the current date and 01/01 of the current year.

I've tried several expressions and here's the latest:
#FORMAT(["01/01/" & Year(Date)],"mm/dd/yyyy")#

Another one, but CTOD wasn't recognized.
CTOD("01/01" & Year(Date))

This would be accomplished by a to_date in oracle, concatenating 01/01 and the dynamic year.

I'm also open to changing the query if necessary. I also know this is probably a no brainer and have poured through many google and access help information and looked at date formats, but I cannot get my syntax to work. Also, if there is a website you think would be useful for a novice access programmer, I'd like to know what that is.

Thanks ahead of time for your help.
Reply With Quote
  #2 (permalink)  
Old February 20th, 2007, 04:58 AM
Registered User
 
Join Date: Oct 2006
Location: chennai, tamil nadu, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to kumarj
Default

Try with cdate function

Reply With Quote
  #3 (permalink)  
Old February 21st, 2007, 02:10 AM
Registered User
 
Join Date: Feb 2007
Location: Greenacres, FL, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this and tell me if this works (Paste this into the criteria box for the date field):
Between Date()-Format(Now(),"y")+1 and Date()
Reply With Quote
  #4 (permalink)  
Old April 13th, 2007, 11:18 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for answering me. I've been away from this project for a little while and just thought to look. No, that doesn't work. The error message is

The expression you entered contains invalid syntax. You omitted an operand or operator, you entered an invalid character or comma, or you entered text w/o surrounding it with quotation marks.

I get this in the selection criteria or the expression builder when attempting to get the mm for a date field in the database. Here is what I put in the selection criteria:
Between Date()- Format(Now(),"yy")+1 And Date()

Reply With Quote
  #5 (permalink)  
Old April 16th, 2007, 03:04 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I believe I've figured out that there must be a problem with the Design View and the date functions that have several arguments with them. So, Date() works, but DateADD does not. The interesting thing is I can go to SQL View and enter the sql I need and save. However, when I switch back to the Design View, there are vertical bars (|) instead of commas. If I attempt to switch back to SQL View, then an error is displayed about the illegal use of vertical bars. So, at this point, if I need to change my query, I'll have to wipe out the portions it can't handle, go into SQL View and write and save the new query.

I am currently on Windows XP SP2 and my msjet40.dll is at version level 4.0.8618.0, which appears to be the latest and greatest. If anyone has any ideas about how to fix what I am experiencing, I'd be
glad to hear it. I read about the sandbox problem, but my versions seem to be fine. I switched my sandbox registry level to a 3, but that didn't fix my problem.

Dale

Reply With Quote
  #6 (permalink)  
Old June 11th, 2007, 10:13 AM
Registered User
 
Join Date: Jun 2007
Location: , CT, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This will return the first day of the current year:

DateSerial(Year(Now()),1,1)

so you could use

between Date() and DateSerial(Year(Now()),1,1)



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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Date Display velcrobomb SQL Language 3 April 3rd, 2007 10:10 AM
Crosstab - Limiting Date On Formulas - Dynamic Dat vashknight Crystal Reports 0 October 19th, 2006 05:23 PM
parsing concatenated strings? poobaah Beginning PHP 4 October 28th, 2004 02:40 AM
TCP/IP Data is Being Concatenated owain Pro VB 6 2 December 9th, 2003 08:12 PM
New line in concatenated field NK Oracle 1 July 15th, 2003 10:27 PM



All times are GMT -4. The time now is 07:43 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.