Access quit after saving query

M

matadorMatt

I wrote a query in sql...the sql is below....and then when I save, Access
quits without an error message. I have done a compact/repair and also pasted
the SQL into a new query object and still get the same results. I couldn't
find anything on support.miscrosoft.com regarding this issue. Has anyone
come across this? Is there a fix for this?

SELECT [start close of business dt] AS start_dt, [end close of business dt]
AS end_dt, a.[Trading Desk], iif(len(a.salesperson)>1 and a.brokername is
null, "sales",iif((len(a.salesperson)<2 or a.salesperson is null) and
a.brokername is not null,"broker",iif((len(a.salesperson)<2 or a.salesperson
is null) and a.brokername is null and left(ltrim(a.CP_name),2) like
"JP","internal","broker"))) AS ind, sum( iif(a.index IN ("0"),1 ,0)) AS
single_name, sum(iif(a.index IN ("1","2","3"),1,0)) AS [index]
FROM tblVolume AS a
WHERE a.tradedate between [start close of business dt] and [end close of
business dt]
GROUP BY a.[Trading Desk], iif(len(a.salesperson)>1 and a.brokername is
null, "sales",iif((len(a.salesperson)<2 or a.salesperson is null) and
a.brokername is not null,"broker",iif((len(a.salesperson)<2 or a.salesperson
is null) and a.brokername is null and left(ltrim(a.CP_name),2) like
"JP","internal","broker")));
 
J

Jerry Whittle

The convoluted series of nexted IIf statements makes me think that your
database isn't problem normalized; however, that probably isn't the main
problem. I bet that your database is corrupt.

Tony Toews has an excellent web page on database corruption.
http://www.granite.ab.ca/access/corruptmdbs.htm

Allen Brown also has excellent info on corruption.
http://allenbrowne.com/ser-47.html

I have a white paper in a Word document named Fix Corrupt Access Database
towards the bottom this page:
http://www.rogersaccesslibrary.com/OtherLibraries.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top