Referencing VBA in a Query

k209310

Registered User.
Local time
Today, 01:35
Joined
Aug 14, 2002
Messages
184
last question. When i have done this bit im finished my task. Unless the answer to my question is "This is impossible" in which case ill be here all day

Is it possible to reference a result to a formaula that is calculted in VBA in a Query.

Colin if your still there you mentioned before about referencing the combobox with [Forms]![FORM1]![Combo0]. Is it possible to referecne the function and then the result in a query

something like [commandbuttonClick]![strResult] for example.
 
You've lost me.

Do you want to use a function as criteria in a query?

Col
 
i think so yes

something like this (strResult being the result of a formaula that takes place in a command click proceedure. (the click is what will start the query running)

UPDATE tblTest SET [Melt ID/Tube ID] = strResult
WHERE [Melt ID/Tube ID]=[Forms]![FORM1]![Combo0];
 
If you are running a Function on a button and also want it somewhere else (like in a query) it may be better to create the Function in Modules and call it from the button to do whatever, then call it again in the query.

or am I on the wrong track?

Col
:cool:
 
that sounds about right i dont have a problem creating the functions in VBA do you know how to reference them in the query once they have been produced?
 
In the criteria line of the relevant field put the Function name

e.g.

AgeCalc()

Col
:cool:
 
thanks colin ill buy you a pint someday.

Chris
 
I think FedEx may spill it. Just send money!!!

Glad I could help

Col
:cool:
 

Users who are viewing this thread

Back
Top Bottom