Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 29th, 2008, 04:50 PM
thermanson thermanson is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 3 thermanson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 27 sec
Reputation Power: 0
Error using date in Linked table query

Hello all

I am using Access 2000 as a front end (GUI) with a SQL 2005 database and have several linked tables. An user encountered an odd error that I cannot figure out.

He created a query that had criteria on a date. When he tries to run it the query will not do anything. If he closes out of the query and does any other operation he gets the "This Action will reset the current code in break mode." error and will have to close out access before he can do anything else.

I'm found some strange work-arounds but want to fix the problem the correct way. Below are two examples - the first one causes the error the second one is the work-around that returns the desired results.

1. Criteria >#1/1/2008#
2. Criteria >DateAdd("d",0,#1/1/2008#)

Any ideas?

Reply With Quote
  #2  
Old April 30th, 2008, 05:00 PM
dykebert's Avatar
dykebert dykebert is offline
Contributing User
Click here for more information. Click here for more information
 
Join Date: Apr 2008
Posts: 266 dykebert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 18 h 23 m 7 sec
Reputation Power: 1
I'm not sure that SQL server uses "#"

Have you tried:
Criteria > '01/01/2008'

Reply With Quote
  #3  
Old May 1st, 2008, 08:50 AM
thermanson thermanson is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 3 thermanson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 27 sec
Reputation Power: 0
Dykebert,
Thanks for the reply, but I don't think that's the fix.

Your right SQL does use dates in the '01/01/2008' format. Access forces the # - If you enter just 01/01/2008 it changes it for you. If you try '01/01/2008' or "01/01/2008" Access gives a Data type mismatch error. If I go to the SQL view you can change the criteria to just 01/01/2008, but then all results are returned as if the criteria is ignored.

Is this a known bug? Should I just live with the work-around?

Reply With Quote
  #4  
Old May 1st, 2008, 09:04 AM
dykebert's Avatar
dykebert dykebert is offline
Contributing User
Click here for more information. Click here for more information
 
Join Date: Apr 2008
Posts: 266 dykebert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 18 h 23 m 7 sec
Reputation Power: 1
I don't know about a bug, but it is certainly an inconsistency.

You could try forcing a pass through query or just use CDate rather than the DateAdd.

Reply With Quote
  #5  
Old May 1st, 2008, 09:20 AM
thermanson thermanson is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 3 thermanson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 27 sec
Reputation Power: 0
Using a parameter query also works. (ie. > [Enter Date])

Something is being lost in translation between Access and SQL Server. I'm not really an Access developer, but a SQL guy. I decided to use Access for this project to give the end users a little bit of control with Reports and Queries hoping that I wouldn't run into any of this funny stuff.

Thanks again.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Error using date in Linked table query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway