Hi there.
I've been working in a form all morning trying to do a bit of manipulation. This is the general idea of what I'm trying to do:
I have one form where there is an input that you type in specifying what field you want to be used for "Amount." You can type anything in this box for example Field1, Field2, Field3, etc.
I have another form that calculates average and I want it to calculate the average of the field name that is typed in the initial box. If I type Field1 initially, I want it to average all of Field1. If I typed Field2, I'd want it to average Field2 in the same box.
Now I've gotten to the point where I can make a text box appear that says the field that I typed in by linking it to the first form in the Control Source. Now I just need to be able to change the expression to take the average of that actual field instead of just displaying the field name. I tried several things as the Control Source.
I'm basically trying to make the Control Source see Avg([Field1]), which does calculate if I type it in manually.
When I have in the Control Source
"[" & CStr([Forms]![Form Select Amount]![Amount]) & "]"
I see [Field1]
But when I try something like
Avg("[" & CStr([Forms]![Form Select Amount]![Amount]) & "]")
or
Avg("[" & CVar([Forms]![Form Select Amount]![Amount]) & "]")
I just get an #error message.
Any help would be greatly appreciated. I'm new to access and the forum so I apologize if I broke any forum etiquette.
Thank you!