Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 28th, 2004, 12:31 PM
GaryN GaryN is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 35 GaryN User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Question regarding a field

I have a report that I am creating with Access2000 frontend and SQL server backend. I am adding a field called "Plates Made".

Each order coming in receives an order number which is placed in a table with other information. The order will go through multiple stages of production. Each stage is entered into the table. There can be multiple entries entered for the same order number. The final stage is Plates Made, OrderStatusID = 20, which is the status I am looking for to appear on the report. The issue that I am having, is that I am getting the previous entries and not the final "Plates Made". If the plate is not made, I have code written in the Stored Procedure which states: IF StatusID=20 then Plates Made Else Plates not made. However, it's not working properly. Please see the stored procedure below. Thanks in advance for the assistance.

Alter Procedure dbo.spBMCoverScheduleTEST
As
SELECT BookAll.JobNum, [Cover Print Process].CvrPrntProcessID,
[Cover Print Process].CvrPrntProcess, BookAll.DateIn,
[Scheduling - AD].dtPrintCvr2, [Scheduling - AD].dtPrintTxt2,
[Scheduling - AD].TxtPrfStatus, [Scheduling - AD].CvrPrfStatus,
BookAll.Author, Publisher.PublisherCode,
[Binding Style].BindStyleAbbr, BookAll.TotalWidth,
BookAll.AllCovers + BookAll.ExtraCvrs AS Quantity,
[Cover Colors].CvrColor, [Scheduling - AD].dtBNBInvRec,
[Scheduling - AD].dtBound, [Scheduling - AD].dtShipped,
[Scheduling - AD].dtBound2, [Scheduling - AD].BNBDelivery,
--[Proof Job Type].ProofCode,
[Scheduling-LoadedDates].PrintCoverDue, Hold, HotJob,
vPlatesMade.[End], vPlatesMade.StatusID,

'JobDueDate' =
CASE
WHEN [Hold] = 1 THEN '9/9/99'
WHEN ([DaysOnHold] Is Not Null AND [CustomerDelay] = 1 And [Take Off Hold] = 1)
THEN (dbo.BoundBook.BoundBook + [DaysOnHold])
ELSE (dbo.BoundBook.BoundBook)

END,

'CoverStatus' =
CASE
WHEN [CvrPrfStatus] = '28' THEN 'RTP, Needs Plates'
ELSE 'RTP'

END,

'Text Status' =
CASE
WHEN [dtPrintTxt2] is not null THEN 'Text Printed'
When [dtPrintTxt2] is null and [TxtPrfStatus] = '12' Then 'RTP'
ELSE 'Not RTP'

END,

'PlateStatus' =
CASE
WHEN ([StatusID] = 20) THEN 'Plate Made'
ELSE 'Plate Not Made'

END



FROM dbo.BookAll INNER JOIN
dbo.[Scheduling - AD] ON
dbo.BookAll.JobNum = dbo.[Scheduling - AD].JobNum INNER JOIN
dbo.[Job - ED] ON
dbo.BookAll.JobNum = dbo.[Job - ED].JobNum INNER JOIN
dbo.Publisher ON
dbo.BookAll.PublisherID = dbo.Publisher.PublisherId INNER JOIN
dbo.[Cover Print Process] ON
dbo.BookAll.CvrPrntProcessID = dbo.[Cover Print Process].CvrPrntProcessID
LEFT OUTER JOIN
--dbo.[Proof Job Type] ON
--dbo.[Scheduling - AD].CvrPrfStatus = dbo.[Proof Job Type].ProofCodeID INNER JOIN
dbo.vPlatesMade ON
dbo.BookAll.JobNum = dbo.vPlatesMade.JobNum LEFT OUTER JOIN
dbo.[Scheduling-LoadedDates] ON
dbo.BookAll.JobNum = dbo.[Scheduling-LoadedDates].JobNum LEFT
OUTER JOIN
dbo.BoundBook ON
dbo.BookAll.JobNum = dbo.BoundBook.JobNum LEFT OUTER JOIN
dbo.[Hot Jobs] ON
dbo.BookAll.JobNum = dbo.[Hot Jobs].JobNum LEFT OUTER JOIN
dbo.[Cover Colors] ON
dbo.BookAll.CvrColorID = dbo.[Cover Colors].CvrColorID LEFT OUTER
JOIN
dbo.[Binding Style] ON
dbo.BookAll.BindStyleID = dbo.[Binding Style].BindStyleID LEFT
OUTER JOIN
dbo.tblHoldJobs ON
dbo.BookAll.JobNum = dbo.tblHoldJobs.JobNumber
WHERE (dbo.[Scheduling - AD].dtBNBInvRec IS NULL) AND
(dbo.[Scheduling - AD].dtBound IS NULL) AND
(dbo.[Scheduling - AD].dtShipped IS NULL) AND
(dbo.[Scheduling - AD].dtBound2 IS NULL) AND
(dbo.[Scheduling - AD].BNBDelivery IS NULL) AND
(dbo.BookAll.DateIn > CONVERT(DATETIME,
'2002-12-31 00:00:00', 102)) AND
(dbo.[Scheduling - AD].dtPrintCvr2 IS NULL) AND
(dbo.[Cover Print Process].CvrPrntProcessID = 1 OR
dbo.[Cover Print Process].CvrPrntProcessID = 2 OR
dbo.[Cover Print Process].CvrPrntProcessID = 3) AND
(dbo.[Scheduling - AD].TxtPrfStatus = 12) AND
(dbo.[Scheduling - AD].CvrPrfStatus = 12 OR
dbo.[Scheduling - AD].CvrPrfStatus = 20 OR
dbo.[Scheduling - AD].CvrPrfStatus = 26 OR
dbo.[Scheduling - AD].CvrPrfStatus = 28)AND
dbo.BookAll.PODScanOnly is null AND
(dbo.[Scheduling-LoadedDates].PrintCoverDue IS NOT NULL)

Reply With Quote
  #2  
Old January 28th, 2004, 04:46 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Which part of your statement is not working

The criteria

OR

'PlateStatus' =
CASE
WHEN ([StatusID] = 20) THEN 'Plate Made'
ELSE 'Plate Not Made'


S-

Reply With Quote
  #3  
Old January 29th, 2004, 07:45 AM
GaryN GaryN is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 35 GaryN User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
what is happening, is that the job will in most cases have a previous status prior to the plates being made, (which is a statusID of 20). I am receiving the other StatusID's and not just the StatusID of 20, which is what I want.

Reply With Quote
  #4  
Old January 29th, 2004, 10:35 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
You never specify, in the where portion of your statement, that you want a StatusID = 20

S-

Reply With Quote
  #5  
Old January 29th, 2004, 12:05 PM
GaryN GaryN is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 35 GaryN User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Actually just figured that out after I sent the above response. Thanks anyway for your help. As always, it's much appreciated.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Question regarding a field


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway