D
Damian Carrillo
I am trying to take a complex query that works via the Query Analyzer
in SQL Server 2005 to work in MS Access 2003. Suffice it to say Access
is not my preferred environment in which to do this work, however given
the circumstances pertaining to licensing and systems policy, its the
only thing availible for this project. The following query works fine
in the Query Analyzer on a Windows 2000 Server box running SQL Server
2005:
Select DISTINCT rtrim(v.vendor_id) as vendor_id, rtrim(i.invoice_num)
as invoice_num,
i.invoice_status, i.invoice_date,i.period, i.inv_amt, v.vendor_name,
i.image_id as 'barcode',ch.check_num, ch.check_date,
'Office: ' + a.offc + '; Dept: ' + a.dept + '; Acct:' +
rtrim(c.acct_code) + ' - ' + c.acct_desc As description,
i.tran_uno,
i.session, ch.check_status
left join cmsopen.dbo.apt_invoice_amt ia ON i.tran_uno =
ia.inv_tran_uno And ia.tran_type='CH'
left join cmsopen.dbo.apt_check ch ON ia.source_tran_uno = ch.tran_uno
inner join cmsopen.dbo.act_tran_je a ON i.tran_uno = a.tran_uno
inner join cmsopen.dbo.glm_chart c ON a.acct_uno = c.acct_uno
Where 1=1 And a.offc='01' And a.tran_type = 'AP' Order By 1,2 ASC
I set up the same tables in MS Access 2003 as Linked tables. I can run
a huge number of queries but this is the most complex one I've tried,
and I can't seem to make it work, so I am thinking it must be
punctuation or keywords or something from SQL Server 2005 that isn't
common to the Microsoft JET SQL or ANSI SQL. Here's my attempt to
convert the statement, but it always erros out with: "Syntax Error
(missing Operator) in Query Expression"
SELECT DISTINCT rtrim(v.vendor_id) AS VendorID, rtrim(i.invoice_num) AS
invoice_num,
i.invoice_status, i.invoice_date, i.period, i.inv_amt, v.vendor_name,
i.image_id AS BarCode, ch.check_num, ch.check_date,
'Office: ' + a.offc + '; Dept: ' + a.dept + '; Acct:' +
rtrim(c.acct_code) + ' - ' + c.acct_desc AS Description,
i.tran_uno, i.session, ch.check_status
FROM dbo_apt_invoice i
INNER JOIN dbo_apm_vendor v ON i.vendor_uno = v.vendor_uno
LEFT JOIN dbo_apt_invoice_amt ia ON i.tran_uno = ia.inv_tran_uno AND
ia.tran_type='CH'
LEFT JOIN dbo_apt_check ch ON ia.source_tran_uno = ch.tran_uno
INNER JOIN dbo_act_tran_je a ON i.tran_uno = a.tran_uno
INNER JOIN dbo_glm_chart c ON a.acct_uno = c.acct_uno
WHERE 1=1 AND a.offc='01' AND a.tran_type = 'AP' ORDER BY 1,2 ASC
Anyone care to hypothesize as to why this is failing?
in SQL Server 2005 to work in MS Access 2003. Suffice it to say Access
is not my preferred environment in which to do this work, however given
the circumstances pertaining to licensing and systems policy, its the
only thing availible for this project. The following query works fine
in the Query Analyzer on a Windows 2000 Server box running SQL Server
2005:
Select DISTINCT rtrim(v.vendor_id) as vendor_id, rtrim(i.invoice_num)
as invoice_num,
i.invoice_status, i.invoice_date,i.period, i.inv_amt, v.vendor_name,
i.image_id as 'barcode',ch.check_num, ch.check_date,
'Office: ' + a.offc + '; Dept: ' + a.dept + '; Acct:' +
rtrim(c.acct_code) + ' - ' + c.acct_desc As description,
i.tran_uno,
i.session, ch.check_status
inner join cmsopen.dbo.apm_vendor v ON i.vendor_uno = v.vendor_unoFrom cmsopen.dbo.apt_invoice i
left join cmsopen.dbo.apt_invoice_amt ia ON i.tran_uno =
ia.inv_tran_uno And ia.tran_type='CH'
left join cmsopen.dbo.apt_check ch ON ia.source_tran_uno = ch.tran_uno
inner join cmsopen.dbo.act_tran_je a ON i.tran_uno = a.tran_uno
inner join cmsopen.dbo.glm_chart c ON a.acct_uno = c.acct_uno
Where 1=1 And a.offc='01' And a.tran_type = 'AP' Order By 1,2 ASC
I set up the same tables in MS Access 2003 as Linked tables. I can run
a huge number of queries but this is the most complex one I've tried,
and I can't seem to make it work, so I am thinking it must be
punctuation or keywords or something from SQL Server 2005 that isn't
common to the Microsoft JET SQL or ANSI SQL. Here's my attempt to
convert the statement, but it always erros out with: "Syntax Error
(missing Operator) in Query Expression"
SELECT DISTINCT rtrim(v.vendor_id) AS VendorID, rtrim(i.invoice_num) AS
invoice_num,
i.invoice_status, i.invoice_date, i.period, i.inv_amt, v.vendor_name,
i.image_id AS BarCode, ch.check_num, ch.check_date,
'Office: ' + a.offc + '; Dept: ' + a.dept + '; Acct:' +
rtrim(c.acct_code) + ' - ' + c.acct_desc AS Description,
i.tran_uno, i.session, ch.check_status
FROM dbo_apt_invoice i
INNER JOIN dbo_apm_vendor v ON i.vendor_uno = v.vendor_uno
LEFT JOIN dbo_apt_invoice_amt ia ON i.tran_uno = ia.inv_tran_uno AND
ia.tran_type='CH'
LEFT JOIN dbo_apt_check ch ON ia.source_tran_uno = ch.tran_uno
INNER JOIN dbo_act_tran_je a ON i.tran_uno = a.tran_uno
INNER JOIN dbo_glm_chart c ON a.acct_uno = c.acct_uno
WHERE 1=1 AND a.offc='01' AND a.tran_type = 'AP' ORDER BY 1,2 ASC
Anyone care to hypothesize as to why this is failing?