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

Setvalue on a multiple tabs with the same procedure 1

Status
Not open for further replies.

Quotidius

Technical User
Jan 27, 2002
29
0
0
US
My form has a subform1. Subform1 has 5 tabs each with 2 fields: Field 1 is an employee’s score of themselves (self appraisal). Field 2 will represent their manager's appraisal of the employee. Both are option groups with values 1 thru 5. I have placed on each record a command button for a manager to say "I agree" so that it sets his Field 2 = Field 1 score.

The trouble is my macro that works so well on Tab 1 has to have the path it references altered for each of the other 4 tabs, in essence creating 5 macros.

Could VB more effectively handle this? Recommended threads or advice greatly appreciated.
 
Absolutely...
Assuming you have a naming convention such as similar controls on all tabs be called txtScore0, txtScore1...txtScoreN, where the number is the page index on the Tab control:

For i = 0 To Me.tabControlName.Pages.Count-1
Me("txtScore" & i) = YourValue
Next

Depending on your naming convention, the code might need changing, but that should be a good start.

HTH

[pipe]
Daniel Vlas
Systems Consultant

 
That was simple and easy - but it would have taken me a long time to see it. Thanks Daniel!.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top