Question

I currently have a bunch of queries that have been input into macros, which are called by one parent macro in Access 2007.

At the end of the process I have to switch to the central DB from which we have several ODBC connections and run this query:

update A
set A.PCP_End_Date = B.PCP_End_Date
from dbo.PCP_History A
outer apply (SELECT (min(PCP_Start_Date) -1) PCP_End_Date from dbo.PCP_History x
WHERE x.PCP_Start_Date > A.PCP_Start_Date AND x.PartD_Rx_ID=A.PartD_Rx_ID)B

Is there any way to do this in Access?

What I'm trying to do is say I have two records:

First record is original PCP, PCP_Start_Date, PCP_End_Date (null), and PCP_Update_Date

Then I have a new record:

new PCP, PCP_Start_Date (04-01-2014), PCP_End_Date(Null),PCP_Update_Date(DATE())

I want to set the first records PCP_End_Date to the day before the new records PCP_Start_Date - so in this scenario it would be 03-31-2014 to the end date of the first record.

Hope this makes sense. Let me know. Thanks!

Was it helpful?

Solution

So I solved this myself.

It's called a Pass-through query.

Because I identify the ODBC connection, I put this same syntax into a query, but select Pass-through. A properties window comes up and asks you to select your ODBC connection str.

This worked very well. Awesome.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top