troubleshooting Question

looping through a recordset please., to check to see if all records  are true in the query

Avatar of Fordraiders
FordraidersFlag for United States of America asked on
Microsoft AccessVBA
6 Comments1 Solution67 ViewsLast Modified:
looping through a recordset please., to check to see if all records  are true in the query

I dont know why this is so hard for me to check, but
just trying to see if ALL the records in a query are true

if the "SEND_TO_LEADER" field  =  YES  AND RENEWAL_SKU = "NO"  in ALL the records then  boolean  =  true

' code for recordset
'' ===========================  START CHECK FROM TRUMP ALL
countme = 0
' lets see if a value for "send_to_leader"  as a "YES" and all "renewal_skus" =  "NO"
Set MyDBr = CurrentDb
Set qdr = MyDBr.QueryDefs("Query_FOR_HTML_stl")
qdr.Parameters!ENTERVALUE = [Forms]![main]![dbo_t_redbook_pricing_escalation_detail_subform]![RBP_MASTER_ID]
On Error Resume Next
Set rstr = qdr.OpenRecordset
rstr.MoveLast
rstr.MoveFirst
countme_stl = rstr.RecordCount

If countme_stl > 0 Then
  ' MsgBox "yes", vbDefaultButton1
    gb_renewal_rsy = False
End If

'Else
'    '  MsgBox "no", vbDefaultButton1
'    gb_renewal_rsy = True
'End If
rstr.Close
Set rstr = Nothing
GoTo LINE5
' ====================================   END CHECK


"Query_FOR_HTML_stl"
query:
SELECT dbo_t_redbook_pricing_escalation_detail.RBP_MASTER_ID, dbo_t_redbook_pricing_escalation_detail.SKU, dbo_t_redbook_pricing_escalation_detail.PRODUCT_DESCRIPTION, dbo_t_redbook_pricing_escalation_detail.QTY, dbo_t_redbook_pricing_escalation_detail.TARGET_PRICE, dbo_t_redbook_pricing_escalation_detail.COMPETITOR_PRICE, dbo_t_redbook_pricing_escalation_detail.TARGET_GP, dbo_t_redbook_pricing_escalation_detail.CURRENT_PRICE, dbo_t_redbook_pricing_escalation_detail.CURRENT_GP, dbo_t_redbook_pricing_escalation_detail.VENDOR_GUIDELINE_GP, dbo_t_redbook_pricing_escalation_detail.APPROVED_PRICE, dbo_t_redbook_pricing_escalation_detail.APPROVED_GP, dbo_t_redbook_pricing_escalation_detail.SEND_TO_LEADER, dbo_t_redbook_pricing_escalation_detail.TARIFF_ITEM, dbo_t_redbook_pricing_escalation_detail.RENEWAL_SKU, dbo_t_redbook_pricing_escalation_detail.Line_Color
FROM dbo_t_redbook_pricing_escalation_detail
WHERE (((dbo_t_redbook_pricing_escalation_detail.RBP_MASTER_ID)=[ENTERVALUE]) AND ((dbo_t_redbook_pricing_escalation_detail.SEND_TO_LEADER)="YES") AND ((dbo_t_redbook_pricing_escalation_detail.RENEWAL_SKU)="NO"))
ORDER BY dbo_t_redbook_pricing_escalation_detail.Line_Color;


Thanks
fordraiders
ASKER CERTIFIED SOLUTION
John Tsioumpris
IT Supervisor
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros