uer

  • Thread starter Thread starter DZ
  • Start date Start date
D

DZ

Greetings

i want to use a function that is located in an open form
in a Query column to perform an action on each record.

What is the sytax for referring to a function located in
an open form?

I tried the following with no success.

NewFieldName: Forms!FormName!FunctionName([Field1])
and
NewFieldName: [Forms]![FormName]!FunctionName([Field1])

Thanks for any suggestions


DZ
 
DZ,

Maybe you mean this?...
NewFieldName: FunctionName([Forms]![FormName]![Field1])

If not, maybe you could post back with some more information about the
function and waht it is supposed to do, and the meaning of the Field1
control on the form.
 
Thanks for responding Steve.

I'm sorry for not being clear enough. Let me try to
explain more clearly this time.

I'm creating a query in design view. In one of the column
headings in design view of the Query, I want to use a
function to create a calculated field.

So I type a name for the calculated field "NewFieldName",
followed by the function. For function argument, I insert
the field name, "Field1", so that the function will
process each record in the field named "Field1"

I have used functions in queries before that were either
built-in functions or custom functions that were located
in a standard module with no problem.

So, normally, I would type the following expression in a
column heading in the query (I'm using a built-in
function as an example)

NewFieldName: UCase([Field1])

But I want to use my custom function and it is not located
in a standard module. It is located in the module of a
currently open form. The reason that the function is
located in the form is that I want to encapsulate all of
the functionally of this program inside one form.

I need to know the syntax for referring to my function
that's located in a form.

In a column in query design view, I typed the following
but it did not work.

NewFieldName: Forms!FormName!FunctionName([Field1])
and
NewFieldName: [Forms]![FormName]!FunctionName([Field1])

Thanks form any help

DZ
 
DZ,

Aha! Makes sense now. However, you can't refer to the function by
referencing the form whose class module contains it. And as far as I
know, you can't define a public function in a form's module, I think you
will have to put it in a standard module. Whether the form is open is
not relevant.
 
-----Original Message-----
DZ,

Aha! Makes sense now. However, you can't refer to the function by
referencing the form whose class module contains it. And as far as I
know, you can't define a public function in a form's module, I think you
will have to put it in a standard module. Whether the form is open is
not relevant.
Thanks. I was hoping for a way to do this. I have been
able to refer to a Public function in a form from a
Command button or from another form, but so far have not
been able to fiquire out how to do it from a query.

Thanks for the help

DZ
Steve Schapel, Microsoft Access MVP

Thanks for responding Steve.

I'm sorry for not being clear enough. Let me try to
explain more clearly this time.

I'm creating a query in design view. In one of the column
headings in design view of the Query, I want to use a
function to create a calculated field.

So I type a name for the calculated field "NewFieldName",
followed by the function. For function argument, I insert
the field name, "Field1", so that the function will
process each record in the field named "Field1"

I have used functions in queries before that were either
built-in functions or custom functions that were located
in a standard module with no problem.

So, normally, I would type the following expression in a
column heading in the query (I'm using a built-in
function as an example)

NewFieldName: UCase([Field1])

But I want to use my custom function and it is not located
in a standard module. It is located in the module of a
currently open form. The reason that the function is
located in the form is that I want to encapsulate all of
the functionally of this program inside one form.

I need to know the syntax for referring to my function
that's located in a form.

In a column in query design view, I typed the following
but it did not work.

NewFieldName: Forms!FormName!FunctionName([Field1])
and
NewFieldName: [Forms]![FormName]!FunctionName([Field1])

Thanks form any help

DZ

.
 
DZ,

Just curious... why do you want to? What's wrong with putting it in a
standard module?
 
Back
Top