We help IT Professionals succeed at work.
Get Started

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

Fordraiders
Fordraiders asked
on
59 Views
Last Modified: 2020-03-11
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

Open in new window



"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;

Open in new window



Thanks
fordraiders
Comment
Watch Question
IT Supervisor
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE