Referencing form items

T

Tom Coates

I want to pass the names of a form and an object on that
form to a functioon and then construct a reference using
those parameters. I am having difficulty with the syntax
to construct the reference

function Test(FormName,ObjectName)

debug.print forms!formname.objectname.value

This does not work! Help with the format of the names
(String etc) and the way to construct the reference is
appreciated.
 
R

Randy Harris

Alex Dybenko said:
try:
forms("formname")("objectname").value

If these are being passed to a function, wouldn't he want those without the
quotes?

Forms(FormName)(ObjectName).Value
 
A

Alex Dybenko

if forname is a variable - then without quotes
if forname is a form name - then with quotes
 
P

peter walker

It might be easier and more scaleable to pass in a reference to the form.
Then you can run wild in there<g>
function Test(fForm as Form)
debug.print fForm.objectname.value
debug.print fForm.Name


peter walker
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top