Prev: Test to help resolve problem with e-mail notifications
Next: insert date and time into memo field
From: Susan123 on 28 Jan 2010 15:00 This post is pretty old but exactly what I am looking for. I followed the instructions but for some reason it is erroring at Me.txtOrderCount = intIDCount. I have very little knowledge of code and I am not sure what I am doing wrong. Could you please explain in more detail? Thanks for your help. -- Sue "Ken Sheridan" wrote: > Duane's solution should work with your daily report, but if you are first > grouping the weekly report by days then the same OrderID could appear in more > than one group header if picked and loaded on separate days as this would be > the second group level, so it would again be counted twice. > > A solution would be to count the distinct OrderID values in code in the > report's module. First you'd declare two module level variables, one to hold > a value list of the distinct OrderIDs, one to hold the count. In the detail > section's Print event procedure the OrderID would be added to the value list > and the count incremented each time a new OrderID is encountered. Finally > the value of the count would be assigned to an unbound text box in the report > footer. So the report's module would look something like this: > > Option Compare Database > Option Explicit > > Dim strIDList As String > Dim intIDCount As Integer > > Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer) > > If PrintCount = 1 Then > If InStr(strIDList, "~" & Me.OrderID) = 0 Then > strIDList = strIDList & "~" & Me.OrderID > intIDCount = intIDCount + 1 > End If > End If > > End Sub > > Private Sub ReportFooter_Print(Cancel As Integer, PrintCount As Integer) > > Me.txtOrderCount = intIDCount > > End Sub > > Note that I've used the tilde character as the delimiter for the value list > rather than the more usual comma, colon or semi-colon. This is just in case > you are using a structured OrderID (or equivalent) which might contain one of > those characters. I'm assuming it won't contain a tilde! If it's a simple > number such as an autonumber it will still work of course. > > Ken Sheridan > Stafford, England > > "clueless" wrote: > > > I am new to Access. I have a field OrderID, I need it to count the total # > > of orders for a daily report and a weekly report. The problem is more than 1 > > employee will be dealing with each order (1 employee picks the order, another > > employee verifies and loads the order on the truck), so in the 2 reports it > > shows the same OrderID for both employees and counts it twice; I need it to > > only count it once, and to add more confusion it might be picked and loaded > > the same day or it could be picked on say Monday and loaded on Tuesday. I > > have read all the postings about duplicate counts and my head is spinning. I > > really would appreciate any help that someone can offer me. Thanks in > > advance! > > -- > > clueless >
|
Pages: 1 Prev: Test to help resolve problem with e-mail notifications Next: insert date and time into memo field |