473,416 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Access linked to SQL Server - 2 day offset error

We recently translated the backend db from Access(97) to SQL Server.
We are still using Access frontends. I have an update query in the
Access front end that uses a lookup table to populate fields. The
common fields between the table and the lookup table are the primary
key (LocID) and date & time fields. The query is:

UPDATE tblPT_Offsets INNER JOIN tblPT ON tblPT_Offsets.LocID =
tblPT.LocID SET tblPT.Offset_ft = [tblPT_Offsets].[Offset_ft],
tblPT.Salinity = [tblPT_Offsets].[Salinity]
WHERE (((tblPT.Offset_ft) Is Null) AND ((tblPT.Salinity) Is Null) AND
((Format([Date]+[Time],"mm/dd/yy hh:nn")) Between [StartDate] And
[EndDate]));

This worked fine in Access and seemed to work fine after switching to
Access, but on closer look, there is exactly a 2 day error being
introduced. A quick search of the newsgroups brings up lots of Access
to SQL date problems, but a 2 day offset seems rather strange? Any
ideas??

I know the field names Date and Time are inappropriate, but legacy
issues are a pain in the butt to resolve!! Could this be a problem?

David
Jul 20 '05 #1
3 1848
ar******@yahoo.com (David) wrote in message news:<31**************************@posting.google. com>...
We recently translated the backend db from Access(97) to SQL Server.
We are still using Access frontends. I have an update query in the
Access front end that uses a lookup table to populate fields. The
common fields between the table and the lookup table are the primary
key (LocID) and date & time fields. The query is:

UPDATE tblPT_Offsets INNER JOIN tblPT ON tblPT_Offsets.LocID =
tblPT.LocID SET tblPT.Offset_ft = [tblPT_Offsets].[Offset_ft],
tblPT.Salinity = [tblPT_Offsets].[Salinity]
WHERE (((tblPT.Offset_ft) Is Null) AND ((tblPT.Salinity) Is Null) AND
((Format([Date]+[Time],"mm/dd/yy hh:nn")) Between [StartDate] And
[EndDate]));

This worked fine in Access and seemed to work fine after switching to
Access, but on closer look, there is exactly a 2 day error being
introduced. A quick search of the newsgroups brings up lots of Access
to SQL date problems, but a 2 day offset seems rather strange? Any
ideas??

I know the field names Date and Time are inappropriate, but legacy
issues are a pain in the butt to resolve!! Could this be a problem?

David


Can you post some sample data to show the problem? It's not really
clear from the details above what you're seeing. Are you using the
query above with linked tables in Access?

Simon
Jul 20 '05 #2
On 25 May 2004 18:02:25 -0700, David wrote:
We recently translated the backend db from Access(97) to SQL Server.
We are still using Access frontends. I have an update query in the
Access front end that uses a lookup table to populate fields. The
common fields between the table and the lookup table are the primary
key (LocID) and date & time fields. The query is:

UPDATE tblPT_Offsets INNER JOIN tblPT ON tblPT_Offsets.LocID =
tblPT.LocID SET tblPT.Offset_ft = [tblPT_Offsets].[Offset_ft],
tblPT.Salinity = [tblPT_Offsets].[Salinity]
WHERE (((tblPT.Offset_ft) Is Null) AND ((tblPT.Salinity) Is Null) AND
((Format([Date]+[Time],"mm/dd/yy hh:nn")) Between [StartDate] And
[EndDate]));

This worked fine in Access and seemed to work fine after switching to
Access, but on closer look, there is exactly a 2 day error being
introduced. A quick search of the newsgroups brings up lots of Access
to SQL date problems, but a 2 day offset seems rather strange? Any
ideas??

I know the field names Date and Time are inappropriate, but legacy
issues are a pain in the butt to resolve!! Could this be a problem?

David


Hi David,

I don't know if there is any relation at all, but just yesterday I
answered a question in another newsgroup about a 2-day difference being
introduced when copying data between SQL Server and Excel. That poster
seemed to use the internal date representation instead of formatted dates.
Your query does contain code to format the date, so it should not cause
this effect - but the fact your time difference is 2 days as well does
strike me as funny.

In case you want to check it out, follow the link below.

http://www.google.com/groups?q=excel...4ax.com&rnum=1

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Jul 20 '05 #3
Funnily enough, I did fix my problem with a simple fix, but I'm glad
to understand the problem. (Simon, the queries are in Access
frontends and the tables are linked via ODBC to a SQL Server.)

The sql code I posted (from the access frontend) actually already had
the fix. I had already changed

([Date] + [Time])

to ((Format([Date]+[Time],"mm/dd/yy hh:nn"))

and this fixed the problem. After reading the replies (Hugo, you hit
it on the head), it seems that passing SQL Server dates formatted both
as dates and double and then having SQL Server do date lookups, etc.
is dangerous. But by making sure all dates are passed as dates, I'm
assuming the ODBC translation takes care of the differences in the
date numbering scheme of Access/SQL. I think that sums it up?

thanks!
David
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
5
by: Philippa | last post by:
I'm trying to access data in vba using the openrecordset command. The data in on a SQL Server 2000 database, and I have linked tables to that data. the Table I'm trying to access is one of these...
1
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
7
by: Darren | last post by:
I have been attempting to create a reservation planning form in excel that imports Data from an Access database and inserts that information automaticly into the correct spreed sheet and the...
0
by: Mike Knight | last post by:
(I've also posted this problem on microsoft.public.excel.programming) I have a MS Access 2003 Database named "AS400 Fields.mdb". This database contains links to tables on an AS400. In MS...
4
by: Brent Bigler | last post by:
The computer: W2K server, domain controller, Microsoft.Net Framework 1.1 ======================== The error message: Access to the path "c:\fanmail\newfiles" is denied .... Exception...
21
by: lesperancer | last post by:
I've got an access97 reporting mdb that pulls data (77,000 rows) from a sql server table into a local table to run reports if the local table is part of the reporting MDB, the insert statement...
1
by: BillCo | last post by:
There seems to be a lot of confusion around the groups about linking to an Access mdb with the SQL Server Jet OLE DB provider and I havent been able to find a straight forward solution. Basically,...
12
by: kalyan | last post by:
Hi, I am using Linux + SysV Shared memory (sorry, but my question is all about offset + pointers and not about linux/IPC) and hence use offset's instead on pointers to store the linked list in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.