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

Variable <= => Object pass

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
i have a problem in trying to get some formatting in a report/form which relies on a user interaction or criteria met in an underlying table

basically i have a matrix or table of figures/prices stored in a table. Each price has an assciated checkbox (in another field as Boolean data type) which indicates whether or not this price is used in the calculation.

In a form (for data input) all the prices and checkboxes are visible. I would like the price to change (ie highlight as red) if it's associated checkbox is ticked or unticked.

I know that the most straightforawrd way is to have a "onclick" procedure with each control but two drawbacks are that i have 30+ controls and also you can't initiate on form load (requires a lot of coding)

I have made a start on a sub procedure that should run on form load or form change.....basically the strings "src" and "srcc" refer to control names of the "price" and associated "check box". Incidentally these are also the same names of the controlsource(fields).
I have iterated through the matrix of names and finally have got stuck with a naming convention as my variables (src and srcc) cannot be passed to the object name...is there a workaround??

here is some code

For inti = 1 To 1
For intj = 1 To 5
src = "trigger" & trigger(inti) & "_" & level(intj)
msg = MsgBox(src)
srcc = src & "c"
msg = MsgBox(srcc)
If Me.srcc.Value = False Then 'error here
msg = MsgBox("hurray")
'do some stuff to src
End If
Next intj
 
Are you getting a message about not being able to change a property of a control unless it has the focus? If so, it will probably work if you take the ".Value" property off the statement. Don't ask me why. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top