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!

Eval CommandButton.OnClick

Status
Not open for further replies.

safraser

Programmer
Apr 12, 2001
76
NZ
Hi every one

What I'm trying to do, is on the form load is modify the properties of a few command buttons based on values of a dataset. Which I seem to have working without any problems
Where I'm coming unstuck, is I then want to fire the OnClick event of the first commandbutton I change. because the dataset can be order/filtered by the user I have no idea which button I'm dealing with at run time.

This is the basic method I'm using

Dim OnClickEventCall as String
Dim cmdBtn as CommandButton
Do While Not RecordSet.EOF
Select case RecordSet.Feilds("btnID")
case 1
cmdBtn = Btn1
case 2
cmdBtn = Btn2
...
End Select
With cmdBtn
Set Some Properties etc
OnClickEventCall = cmdBtn.Name & "_Click"
End With
Loop

Do Some other stuff
Eval (OnClickEventCall)

I admit that my vba coding is a bit rusty, bu I can't for the life of me get the syntax for the Eval call correct.

Thanks for the help
 
What are you really trying to do? When I see people using Eval 99% of the time, it is a bad work around for a poor design. There is probably a lot smarter approach.
 
Fair comment, didn't really explain it I guess.

Basically it's a end user defined menu, stored as part of the database, menu options can be turn on/off, moved around at the users discretion.

When clicking a clicking a menu button, it will then activate the corresponding panels with the sub menu items. Creating and ordering the I've got going fine.

Problem is I want to ensure that the panel corresponding to the first menu command button is active when the form first gets displayed to the user.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top