How do I RecordSet

Code:
Select [JCRB Slides Query - Late CIDR].[Fulfillment Group], [JCRB Slides Query - Late CIDR].IIf([DaysLate]>0,"On Time", IIf([DaysLate]<31, "1-30 Days", IIf([DaysLate]<90, "31-90 Days", IIf([DaysLate]<366, "91-1 Year", "Over a Year")))) As Bucket, Count(*) As NumLate
FROM [JCRB Slides Query - Late CIDR]
GROUP BY [JCRB Slides Query - Late CIDR].[Fulfillment Group], [JCRB Slides Query - Late CIDR].IIf([DaysLate]>0,"On Time", IIf([DaysLate]<31, "1-30 Days", IIf([DaysLate]<90, "31-90 Days", IIf([DaysLate]<366, "91-1 Year", "Over a Year"))))

I think i did something wrong cuz I am getting an error. Undefined Function '[JCRB Slides Query - Late CIDR].IIf' in expression
 
You need to fully qualify each test with the tablename I expect?
Might use the Switch() function?
 
Итак, это мое начало. Я хочу пробежаться и подсчитать элементы по их статусу группы выполнения и записать его в таблицу, которую я создал, чтобы я мог посмотреть на цифры для более позднего элемента
there are several compilation errors in your code and there are undeclared variables - the code will not work

in addition, it is absolutely unreadable - the width of the lines is much larger than the width of the screen

a few seconds spent on splitting long lines into short ones, into the screen) in the query editor will allow you to bring it into a readable form and significantly speed up the debugging of the task.
Code:
Dim dbCurr As DAO.Database
Dim rsLate As DAO.Recordset
Dim sq, sw As String   ''''''''''''''''''
Dim tmpCIDRCount, tmpJCRBValid, tmpRASA, tmpRASAHold, tmpCRIB, tmpCRIBHold, tmpDevHold
Dim tmpTandE, tmpTandEHold, tmpReadyforAccept As Long

 response = MsgBox("Have you selected the threat topic and information cutoff date?", _
    vbYesNo + vbCritical + vbDefaultButton2, _
    "Generate CIDR Snapshot Confirmation")
 If response = vbNo Then
  Exit Sub
 End If
'''''''''''''''''''''''''''''''
 Set dbCurr = CurrentDb()
 sq = "Select CdgrToCidr.[CDGR ID#], FulfillmentGroup.[Fulfillment Group],"
 sq = sq & "  CnfToThreat.[Threat Adversary], Cnf.Status, Cnf.[Need By Date] "
 sq = sq & " FROM (((Cnf"
 sq = sq & " INNER JOIN CnfToCdgr"
 sq = sq & "   ON Cnf.[CNF ID#] = CnfToCdgr.[Cnf ID#])"
 sq = sq & " LEFT JOIN CnfToThreat"
 sq = sq & "   ON Cnf.[CNF ID#] = CnfToThreat.[Cnf ID#]) "
 sq = sq & " INNER JOIN CdgrToCidr"
 sq = sq & "  ON CnfToCdgr.[CDGR ID#] = CdgrToCidr.[CDGR ID#])"
 sq = sq & " INNER JOIN FulfillmentGroup"
 sq = sq & "  ON CdgrToCidr.[Fulfillment Status] = FulfillmentGroup.[Fulfillment Status] "
 sq = sq & " GROUP BY CdgrToCidr.[CDGR ID#], FulfillmentGroup.[Fulfillment Group],"
 sq = sq & "  CnfToThreat.[Threat Adversary], Cnf.Status, Cnf.[Need By Date] "
 sq = sq & " HAVING ((CdgrToCidr.[Fulfillment Status] Not Like 'Rejected*')"
 sq = sq & " AND ((Cnf.Status) Like 'JCRB Validated*'))"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 sw = Me.cmdSelThreatTopic.Value
 If (sw = "Other" Or sw = "Agnostic" Or sw = "All") Then
  sq = sq & " And CnfToThreat.[Threat Adversary] Not Like 'CHN'  "
  sq = sq & " And CnfToThreat.[Threat Adversary] Not Like 'IRN'  "
  sq = sq & " And CnfToThreat.[Threat Adversary] Not Like 'PRK'  "
  sq = sq & " And CnfToThreat.[Threat Adversary] Not Like 'RUS'  "
  sq = sq & " And CnfToThreat.[Threat Adversary] Not Like 'VEO'  "
 Else
  sq = sq & " AND CnfToThreat.[Threat Adversary] = '" & sw & "'"
 End If
 

Users who are viewing this thread

Back
Top Bottom