Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to declaire a variable 1

Status
Not open for further replies.

PositiveParrot

Technical User
Apr 16, 2004
19
GB
Hi there i need some help!

What it is i need to declaire a variable called Payroll_no
and store 3 payroll number fields into it, the fields are from seperate tables within the same database.

And then how do i use the variable within a formula ?

Regards

PP
 
Declaring variables is pretty straight forward in crystal, but I think you need to give more informnation about your report layout, sample data and expected outcome of your report.

You need to declare the variable as a type i.e. NumberVar, StringVar etc.. these variable types only hold single values but the value can be changed a s the reports runs.

to hold multiple values the variable must be deckared as an array i.e.

Shared StringVar Array ArrPayroll;
Redim ArrPayroll [3] 'This will alow 3 values to be held within the variable array.

If you post more information we can point you to the correct variable type and requirements.

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
Hi GJParker

The report am designing is a drill down report for train travel and i have 3 access databaes tabels FirstClass, Secondclass And OtherClass, I need to store all the payroll numbers from each table (in which turned out to be an array not a variable now)then with that array i need to look the payroll numbers up on my employee table to find out which department they belong to and if the payroll number is not there is should be put into a "Invalid Payroll Number" Group.

This is how i normally do it when am working with 1 table and not 3

If Isnull ({Table.PayrollNo}) Then "Invalid Payroll Number" Else {Table.PayrollNumber}
 
Just add the employee table in 3 times and link one to each of your class tables. (Alias Tables)

Then use a formula

If Isnull ({EmpTable1.PayrollNo}) and Isnull ({EmpTable2.PayrollNo}) and Isnull ({EmpTable3.PayrollNo}) Then "Invalid Payroll Number" Else {Table.PayrollNumber}

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
how is your report structured (Grouped)....how are the tables linked???

Provide all the information....don't make us play 20 Questions!!

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top