Inserting Function as Feild in Query

Ragnar78

Board Regular
Joined
Feb 10, 2004
Messages
210
Hy,

I want to add a feild in my query that is calculated by a function in my modules.

So my query goes like this

Code:
Select Feild1, Feild2, Feild3, MyFunction(Feild2) into Table 2 frOm Table1

Can i write the code like this? cause i've been having some difficulties launching the query...
Does the variable in MyFuction should not be a feild selected in the query?

Thanks again
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Yes, this is possible, you can use a VBA function and write the results of that function to a table. If you're getting errors, it may be because there is an error in the function or because you are trying to pass in or return Nulls (which is possible to do, you just have to make sure that you declare everything in the Module as Variant). Of course, it may also be a problem with your SQL, in which case I'd use Access's Query-Builder to build a Make-Table query and just add in your function-generated field there.
 
Upvote 0
I have problems with the wizards...(Class not Registered Topic)...i have to retype most of the codes (good training, but go figure them out when you're a n00b)

Thanks again for the help, i'll just Set the Type of the feild and check the result of the function to be of the same type...i think as you said this might be the problem...

Thanks again
 
Upvote 0

Forum statistics

Threads
1,221,707
Messages
6,161,411
Members
451,704
Latest member
rvan07

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top