CHANGECOMPANY to update a field in all companies

lgp
lgp Member Posts: 77
Hi,
I need to clear a field in all companies in a database. I understand that I can use CHANGECOMPANY to do this. However, it looks like I have to name each company in the program. I'd like to re-use this report for different databases. Does anyone know of a way to have the program run through each company in the database and clear the field in the vendor table without using the company names, to keep the program generic?
Thanks!
Leanne G. Paul
Business Applications/IT Advisor, Competitive Edge Services

Answers

  • matttrax
    matttrax Member Posts: 2,309
    Just iterate through through the Company table.

    Declare a record variable named Company with subtype Company.
    IF Company.FINDSET THEN
      REPEAT
        Rec.CHANGECOMPANY(Company.Name);
        Rec.DoSomething;
      UNTIL Company.NEXT = 0;
    
  • lgp
    lgp Member Posts: 77
    I will try this - thanks for the quick reply!
    Leanne G. Paul
    Business Applications/IT Advisor, Competitive Edge Services
  • lgp
    lgp Member Posts: 77
    Update - this worked. Thanks again! \:D/
    Leanne G. Paul
    Business Applications/IT Advisor, Competitive Edge Services
  • matttrax
    matttrax Member Posts: 2,309
    Don't forget to mark your post as solved