Solved

How to run a self-write function in an access query?

Posted on 2012-03-18
3
384 Views
Last Modified: 2012-03-18
Dear all experts,

I write a function in access and place it in module, let say:

fx_ReturnNumber (strTemp as string) as string
  Dim strTemp2 as string

  strTemp2 = strTemp & " -  Hello World"
 
  fx_ReturnNumber = strTemp2
End Function

If I can bind about function to my query, the result of the query will look like that

ABC - Hello World
CDE - Hello World
EEF - Hello World
...
..
..
..
XZX - Hello World

I've some query and want to use this function but I cannot include it, does anyone tell me how to accomplish this?  Thanks in advance.
0
Comment
Question by:towo2002
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
Martin Liss earned 300 total points
ID: 37735037
I'm not sure what you mean when you say "I've some query and want to use this function but I cannot include it". Do you mean that you get an error? To use a custom function in a query you do it this way:

CustomFunctionName([fieldname])
0
 
LVL 1

Author Comment

by:towo2002
ID: 37735050
Sorry, I go it.  Thanks.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 37735055
Glad I could help.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question