How can i return the Formula name from crystal Report 9 into VB6

Dear All,

I am passing a text value to a formula in Cry report 9.

   Mireport.FormulaFields.Item(3).Text = frmLogin.MUsername

It works Fine.

The problem is i have many reports. The index for the formula (LUserName ) does not have the
same index in all the reports.

I wish to send the formula value using the name of the formula and not the item(?).

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

In my limited knowledge of Crystal 9 and reading your dilemma, I assume that Crystal 9 does not have strongly typed formula indexes to names.
Therefore, you will have to use the exact index of the formula you are needing.

You have a choice of leaving it as is or to solidify the interface contract by using an enum.

'Declare an enum

Public/Private/Friend Enum iFormula
  Formula0Name = 0
  Formula1 = 1
  Formula2 = 2
  LoginName = 3
  Formula4 = 4
End Enum

So in your procedure

You could write:

   Mireport.FormulaFields.Item(iFormula.LoginName).Text = frmLogin.MUsername

You can also use subs or functions to increase the contract coupling.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.