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

Using variable VALUES in VBA code 1

Status
Not open for further replies.

jdrks

MIS
Feb 13, 2007
2
US
I have a MS Access 2003 database application I'm writing. I have several forms with a series of controls on them. The controls are in basically two categories, an answer category displayed as comboboxes, and a score category displayed as text boxes.

The way that the form works, is the end-user selects an answer an it updates the corresponding score text box. I can accomplish this by manually typing in each name of each control, however, to be more effecient, I'd like to use a common procedure that is called by each combobox event. The names are like QUESTIONAnswer and QUESTIONScore. I can get the name of the combobox by using the me.activecontrol.name method. I have even figured out how to use the replace function to store the QUESTIONScore name in a variable.

Now to my problem, my thought was to use VARIABLE.Value = 0, however that doesn't work. I am wanting VBA to interpret VARIABLE.Value = 0 as QUESTIONScore.Value = 0 at runtime.

Is this even possible? Thank you in advance for any assistance!
 
Yes, it is.

[tt]avar="Question1"
Me(avar)=0[/tt]
 
Thanks Remou! That is EXACTLY what I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top