Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Emergency !!!!!

Status
Not open for further replies.

indyaries

Technical User
Jun 6, 2002
24
US
Using Access 97 SR1

Greetings,

I've inherited an emergency that I cannot seem to resolve in a payroll database. The DB is run strictly from Macro's. Hoping someone can help with this ASAP, as this process must be run this morning (Now 08:20 in Indiana)

I need to add two APC codes to the 3 that are already in a MakeTable query called "IDT-INPUT - Table". When I add the two new APC, the macro crashes, displaying a parameter textbox asking for TA.

Step1: Transfer Text from a remote file into a table called "IDT".
Step2: Runs a Make Table query called "IDT-INPUT - Table". The query come from table "IDT". Note that this table is empty until the Transfer Text in Step1 is run. This is where it crashes if I add the two new APC's.

Here is the SQL of the original Make Table Query:

SELECT DISTINCTROW IDT.TA AS Expr1, IDT.B1 AS Expr2, IDT.BLK AS Expr3, IDT.B2 AS Expr4, IDT.FY AS Expr5, IDT.B3 AS Expr6, IDT.DUEDATE AS Expr7, IDT.MANHRS AS Expr8, IDT.OC AS Expr9, IDT.B4 AS Expr10, IDT.EOE AS Expr11, IDT.B5 AS Expr12, IDT.APC AS Expr13, IDT.B6 AS Expr14, IDT.ODC AS Expr15, IDT.DOCNO AS Expr16, IDT.DOV AS Expr17, IDT.IC AS Expr18, IDT.AMOUNT AS Expr19 INTO [IDT INPUT]
FROM IDT
WHERE ((([IDT].[FY])="8" Or ([IDT].[FY])="9" Or ([IDT].[FY])="0" Or ([IDT].[FY])="1" Or ([IDT].[FY])="2" Or ([IDT].[FY])="3" Or ([IDT].[FY])="4") AND (([IDT].[APC])="R151" Or ([IDT].[APC])="R152" Or ([IDT].[APC])="R153"));

Here is the same SQL including the two new APC's (NOTE: This does not work for some reason):

SELECT DISTINCTROW IDT.TA AS Expr1, IDT.B1 AS Expr2, IDT.BLK AS Expr3, IDT.B2 AS Expr4, IDT.FY AS Expr5, IDT.B3 AS Expr6, IDT.DUEDATE AS Expr7, IDT.MANHRS AS Expr8, IDT.OC AS Expr9, IDT.B4 AS Expr10, IDT.EOE AS Expr11, IDT.B5 AS Expr12, IDT.APC AS Expr13, IDT.B6 AS Expr14, IDT.ODC AS Expr15, IDT.DOCNO AS Expr16, IDT.DOV AS Expr17, IDT.IC AS Expr18, IDT.AMOUNT AS Expr19 INTO [IDT INPUT]
FROM IDT
WHERE ((([IDT].[FY])="8" Or ([IDT].[FY])="9" Or ([IDT].[FY])="0" Or ([IDT].[FY])="1" Or ([IDT].[FY])="2" Or ([IDT].[FY])="3" Or ([IDT].[FY])="4") AND (([IDT].[APC])="R151" Or ([IDT].[APC])="R152" Or ([IDT].[APC])="R153" Or ([IDT].[APC])="R155" Or ([IDT].[APC])="R157"));

I'll keep checking back as often as I can, but any e-mail notifications are sent to my home e-mail address.

Thanking all who reply in advance,

Bob in Indy
 
Try:

([IDT].[FY])="4") AND (([IDT].[APC])="R151" Or ([IDT].[FY])="4") AND (([IDT].[APC])="R152" Or ([IDT].[FY])="4") AND (([IDT].[APC])="R153" Or ([IDT].[FY])="4") AND (([IDT].[APC])="R155" Or ([IDT].[FY])="4") AND (([IDT].[APC])="R157"));
 
Rick,

Thanks for the quick reply! I'll give it a try and see what happens.

Bob in Indy
 
Rick,

This is my first opportunity to post again. Your solution didn't work...but I suspect it's not your fault.

I don't pretend to understand how this happens, but there was ANOTHER query....a DELETE query, where the APC criteria also existed....and I had to ensure that the same criteria from the Make-Table query also existed in the Delete query. I don't understand why criteria is needed in this query, which seems to delete all of the data in the IDT table. That @#$%^&* Delete query was there all the time, but I didn't look at it -- simply BECAUSE it was a Delete query. I'm posting the SQL from this query for any who are interested.

I predict that I'll be called upon to rewrite this app, as I've had to rewrite another similar app in the past. Thank you again for your effort, and the rapid response.

Bob in Indy (where it's over 30 degress warmer today than yesterday !!)

DELETE DISTINCTROW IDT.TA AS Expr1, IDT.B1 AS Expr2, IDT.BLK AS Expr3, IDT.B2 AS Expr4, IDT.FY AS Expr5, IDT.B3 AS Expr6, IDT.DUEDATE AS Expr7, IDT.MANHRS AS Expr8, IDT.OC AS Expr9, IDT.B4 AS Expr10, IDT.EOE AS Expr11, IDT.B5 AS Expr12, IDT.APC AS Expr13, IDT.B6 AS Expr14, IDT.ODC AS Expr15, IDT.DOCNO AS Expr16, IDT.DOV AS Expr17, IDT.IC AS Expr18, IDT.AMOUNT AS Expr19, [IDT].[FY], [IDT].[APC], [IDT].[B2]
FROM IDT
WHERE ((([IDT].[FY])="8" Or ([IDT].[FY])="9" Or ([IDT].[FY])="0" Or ([IDT].[FY])="1" Or ([IDT].[FY])="2" Or ([IDT].[FY])="3" Or ([IDT].[FY])="4") AND (([IDT].[APC])="R151" Or ([IDT].[APC])="R152" Or ([IDT].[APC])="R153")) OR ((([IDT].[B2]) Like "T*"));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top