Convert SQL query to Access 2010 query (1 Viewer)

Mike Hughes

Registered User.
Local time
Today, 14:50
Joined
Mar 23, 2002
Messages
493
I have this query which I wrote sometime ago in SQL. I would like to convert it for use in Access 2010 and I'm having problems when I try and run it. I'm getting the error shown in the screen shot which is attached.

Anyone have a suggestion?

Thanks Mike

Select b.worker_id,iv_d_do_code,a.id_payor,b.case_id,a.dt_batch,a.cd_source_batch,
a.no_batch,a.seq_receipt,cd_reason_status,a.amt_to_distribute
From NOLDBA_RECEIPT a, NOLDBA_INT_CASE_STATUS b
Where a.dt_batch between #04/01/2012# and #04/30/2012#
AND b.iv_d_do_code='CC'

AND Not Exists (Select 1 from NOLDBA_RECEIPT k
where a.dt_batch = k.dt_batch
ANd a.no_batch = k.no_batch
And a.cd_source_batch = k.cd_source_batch
And a.seq_receipt = k.seq_receipt
And k.ind_backout = 'Y'
And ((trim(A.Id_Case) IS NOT NULL
AND A.Id_case = b.case_id )
Or
( trim(A.Id_Case) IS NULL
ANd b.case_id = (Select Min(y.case_id) from NOLDBA_INT_CASE_STATUS Y, NOLDBA_INT_CASE_MEMBER Z
Where A.Id_Payor = z.member_id
And z.relation_code IN ('A','P')
And z.case_id = y.case_id )
))
order by iv_d_do_code,b.worker_id
 

Attachments

  • SCREEN SHOT.jpg
    SCREEN SHOT.jpg
    35.5 KB · Views: 124

spikepl

Eledittingent Beliped
Local time
Today, 15:50
Joined
Nov 3, 2010
Messages
6,142
You are missing a whole bunch of

AS

here and there for defining aliases
 

Mike Hughes

Registered User.
Local time
Today, 14:50
Joined
Mar 23, 2002
Messages
493
OK, I can fix that, do you think that is all it is?

Thanks Mike
 

spikepl

Eledittingent Beliped
Local time
Today, 15:50
Joined
Nov 3, 2010
Messages
6,142
Dunno. Try. Access can also be a bit moronic at times and require parantheses here and there and everywhere. I would rebuild the query in the QBE-grid bit by bit, to keep it happy.
 

Mike Hughes

Registered User.
Local time
Today, 14:50
Joined
Mar 23, 2002
Messages
493
spikepl,
That didn't make any difference, I'm still getting the same error.
I'll take your sugestion and try rebuilding it. Thanks Mike
 

Users who are viewing this thread

Top Bottom