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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing a variable on a form.

Status
Not open for further replies.

pgoulet

IS-IT--Management
Dec 9, 2002
45
US
I am printing three different forms. Each form is identical, *except that each copy is identified with who gets which copy, Cashier, Audit, and records.

Is there a way to print only one form 3x and provide each department with a labled copy.

In my experimenting I am printing three copies just fine using a for loop. My thinking is that I should be able to use an IIF statement on a text box. How do I control the value of the variable for comparision.

Thanks

 
Hi,

Why are you printing forms? Reports are for printing.

Anyway, if you think that an iif statement can be used, there MUST be a field on there to be checked with an if statement.

If it's a form, then in the 'On-Current' event of the form, I would say:

lblDept.caption = fldDept.value

Where lblDept is your label name and fldDept is your department field.

When the record changes, the fldDept value changes - trips the 'on-Current' code and the label caption changes.

Regards,

Darrylle
"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Not sure why you're printing a form instead of a report, but you've got the right idea.

For I= 1 to 3

If I = 1 then
Dept= "Cashier"
End If

If I = 2 then
Dept= "Audit"
End If

If I = 3 then
Dept= "Records"
End If

{Rest of code to print form goes here}

Next I

"Dept" could be whatever you need it to be; a lable or text in a text box. Someone out there will say that you should use "If... ElseIf...End If" which would also work; I just think 3 If...End Ifs is clearer to look. And of course you could also use the "Select Case" structure. As usual, there's more than one way to skin a cat.

Hope this helps.

The Missinglinq "It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top