473,811 Members | 3,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to call a function when name is in a variable

really tricky one here.

I want to be able to call a function but the function name is in a variable.
The code is a security module that is querying a table that stores names of
functions, forms, reports etc and what access certain groups have. forms,
reports etc work fine as I use

DoCmd.OpenForm objectToRunName

but how do I do it when "objectToRunNam e" has a function name?

Thanks for any help
Alan
Nov 13 '05 #1
12 2014
Alan,
Do you mean that your objectToRunName comes from a function?

Dim strObject as string
strObject=YourF unction()
DoCmd.OpenForm strObject

--
Hope this helps
Arno R
"Baldy" <Jo**@smith.com > schreef in bericht news:41******** **@news.adelaid e.pipenetworks. com...
really tricky one here.

I want to be able to call a function but the function name is in a variable. The code is a
security module that is querying a table that stores names of functions, forms, reports etc and
what access certain groups have. forms, reports etc work fine as I use

DoCmd.OpenForm objectToRunName

but how do I do it when "objectToRunNam e" has a function name?

Thanks for any help
Alan

Nov 13 '05 #2
Hi Arno

No

the value in objectToRunName is name of the function I want to run.

Thanks for your response
Alan

"Arno R" <ar************ ****@tiscali.nl > wrote in message
news:41******** **************@ dreader2.news.t iscali.nl...
Alan,
Do you mean that your objectToRunName comes from a function?

Dim strObject as string
strObject=YourF unction()
DoCmd.OpenForm strObject

--
Hope this helps
Arno R
"Baldy" <Jo**@smith.com > schreef in bericht
news:41******** **@news.adelaid e.pipenetworks. com...
really tricky one here.

I want to be able to call a function but the function name is in a
variable. The code is a security module that is querying a table that
stores names of functions, forms, reports etc and what access certain
groups have. forms, reports etc work fine as I use

DoCmd.OpenForm objectToRunName

but how do I do it when "objectToRunNam e" has a function name?

Thanks for any help
Alan


Nov 13 '05 #3
On Thu, 7 Oct 2004 21:54:39 +0930, "Baldy" <Jo**@smith.com > wrote:
Hi Arno

No

the value in objectToRunName is name of the function I want to run.

Thanks for your response
Alan

Hi
I have done this in vb6 but forgotten how.
However I see in the access97 help file (useful things) it says:

You can use the Eval function to evaluate an expression that results
in a text string or a numeric value.
You can construct a string and then pass it to the Eval function as if
the string were an actual expression. The Eval function evaluates the
string expression and returns its value. For example, Eval("1 + 1")
returns 2.
If you pass to the Eval function a string that contains the name of a
function, the Eval function returns the return value of the function.
For example, Eval("Chr$(65)" ) returns "A".
David

Nov 13 '05 #4
Try:

Application.Run ObjectToRunName

Tom
"Baldy" <Jo**@smith.com > wrote in message news:<41******* ***@news.adelai de.pipenetworks .com>...
Hi Arno

No

the value in objectToRunName is name of the function I want to run.

Thanks for your response
Alan

"Arno R" <ar************ ****@tiscali.nl > wrote in message
news:41******** **************@ dreader2.news.t iscali.nl...
Alan,
Do you mean that your objectToRunName comes from a function?

Dim strObject as string
strObject=YourF unction()
DoCmd.OpenForm strObject

--
Hope this helps
Arno R
"Baldy" <Jo**@smith.com > schreef in bericht
news:41******** **@news.adelaid e.pipenetworks. com...
really tricky one here.

I want to be able to call a function but the function name is in a
variable. The code is a security module that is querying a table that
stores names of functions, forms, reports etc and what access certain
groups have. forms, reports etc work fine as I use

DoCmd.OpenForm objectToRunName

but how do I do it when "objectToRunNam e" has a function name?

Thanks for any help
Alan


Nov 13 '05 #5
What data type is your variable? I'm having a hard time trying to
figure out why you're doing it this way.

If this has something to do with security and access control, why not
just wrap the function call around an if statement?

if certainGroupsHa veAccess then
call accessGranted()
else
call accessDenied()
end if
"Baldy" <Jo**@smith.com > wrote in message news:<41******* ***@news.adelai de.pipenetworks .com>...
Hi Arno

No

the value in objectToRunName is name of the function I want to run.

Thanks for your response
Alan

"Arno R" <ar************ ****@tiscali.nl > wrote in message
news:41******** **************@ dreader2.news.t iscali.nl...
Alan,
Do you mean that your objectToRunName comes from a function?

Dim strObject as string
strObject=YourF unction()
DoCmd.OpenForm strObject

--
Hope this helps
Arno R
"Baldy" <Jo**@smith.com > schreef in bericht
news:41******** **@news.adelaid e.pipenetworks. com...
really tricky one here.

I want to be able to call a function but the function name is in a
variable. The code is a security module that is querying a table that
stores names of functions, forms, reports etc and what access certain
groups have. forms, reports etc work fine as I use

DoCmd.OpenForm objectToRunName

but how do I do it when "objectToRunNam e" has a function name?

Thanks for any help
Alan


Nov 13 '05 #6
David you are a true legend that is exactly what I want and it works a
treat.
Thanks
Alan

"David Schofield" <d.************ ***@blueyonder. co.uk> wrote in message
news:41656cb3.1 096326@localhos t...
On Thu, 7 Oct 2004 21:54:39 +0930, "Baldy" <Jo**@smith.com > wrote:
Hi Arno

No

the value in objectToRunName is name of the function I want to run.

Thanks for your response
Alan

Hi
I have done this in vb6 but forgotten how.
However I see in the access97 help file (useful things) it says:

You can use the Eval function to evaluate an expression that results
in a text string or a numeric value.
You can construct a string and then pass it to the Eval function as if
the string were an actual expression. The Eval function evaluates the
string expression and returns its value. For example, Eval("1 + 1")
returns 2.
If you pass to the Eval function a string that contains the name of a
function, the Eval function returns the return value of the function.
For example, Eval("Chr$(65)" ) returns "A".
David

Nov 13 '05 #7
Thanks Tom you are also a legend.

Both yours and Davids solutions work.

Alan
"Tom Mitchell" <rt*****@swbell .net> wrote in message
news:70******** *************** ***@posting.goo gle.com...
Try:

Application.Run ObjectToRunName

Tom
"Baldy" <Jo**@smith.com > wrote in message
news:<41******* ***@news.adelai de.pipenetworks .com>...
Hi Arno

No

the value in objectToRunName is name of the function I want to run.

Thanks for your response
Alan

"Arno R" <ar************ ****@tiscali.nl > wrote in message
news:41******** **************@ dreader2.news.t iscali.nl...
> Alan,
> Do you mean that your objectToRunName comes from a function?
>
> Dim strObject as string
> strObject=YourF unction()
> DoCmd.OpenForm strObject
>
> --
> Hope this helps
> Arno R
>
>
> "Baldy" <Jo**@smith.com > schreef in bericht
> news:41******** **@news.adelaid e.pipenetworks. com...
>> really tricky one here.
>>
>> I want to be able to call a function but the function name is in a
>> variable. The code is a security module that is querying a table that
>> stores names of functions, forms, reports etc and what access certain
>> groups have. forms, reports etc work fine as I use
>>
>> DoCmd.OpenForm objectToRunName
>>
>> but how do I do it when "objectToRunNam e" has a function name?
>>
>> Thanks for any help
>> Alan
>>
>>
>
>

Nov 13 '05 #8
Thanks but the problem is there could be thousands of condiftions as the
function being run's name is coming from a table and I need to be able to
add new names without re-writting the code.

Thanks but Tom and David actually had the solution.
Alan

"user_5701" <us*******@hotm ail.com> wrote in message
news:f1******** *************** ***@posting.goo gle.com...
What data type is your variable? I'm having a hard time trying to
figure out why you're doing it this way.

If this has something to do with security and access control, why not
just wrap the function call around an if statement?

if certainGroupsHa veAccess then
call accessGranted()
else
call accessDenied()
end if
"Baldy" <Jo**@smith.com > wrote in message
news:<41******* ***@news.adelai de.pipenetworks .com>...
Hi Arno

No

the value in objectToRunName is name of the function I want to run.

Thanks for your response
Alan

"Arno R" <ar************ ****@tiscali.nl > wrote in message
news:41******** **************@ dreader2.news.t iscali.nl...
> Alan,
> Do you mean that your objectToRunName comes from a function?
>
> Dim strObject as string
> strObject=YourF unction()
> DoCmd.OpenForm strObject
>
> --
> Hope this helps
> Arno R
>
>
> "Baldy" <Jo**@smith.com > schreef in bericht
> news:41******** **@news.adelaid e.pipenetworks. com...
>> really tricky one here.
>>
>> I want to be able to call a function but the function name is in a
>> variable. The code is a security module that is querying a table that
>> stores names of functions, forms, reports etc and what access certain
>> groups have. forms, reports etc work fine as I use
>>
>> DoCmd.OpenForm objectToRunName
>>
>> but how do I do it when "objectToRunNam e" has a function name?
>>
>> Thanks for any help
>> Alan
>>
>>
>
>

Nov 13 '05 #9
"Baldy" <Jo**@smith.com > wrote in news:4165ae71$1 _1
@news.adelaide. pipenetworks.co m:
Thanks but the problem is there could be thousands of condiftions as the
function being run's name is coming from a table and I need to be able to
add new names without re-writting the code.

Thanks but Tom and David actually had the solution.


This is utter bunk. User_9999 gave you some good advice. Although Microsoft
seems happy in confusing data and instructions it is a very bad idea to do
so.

BTW no one becomes a legend because he or she knows some trivial bit of code.

--
Lyle
--
use iso date format: yyyy-mm-dd
http://www.w3.org/QA/Tips/iso-date
--
The e-mail address isn't, but you could use it to find one.
Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1404
by: schaf | last post by:
Hi ! I'm writing a new xsl:function, which uses two other functions. But by the call of the first function, it would be abort just after the call. Not even the xsl:param would be set. I don't have any idea, why this works like this. Could you please help me ? Here my xsl-code: <xsl:function name="rsh:bestanden">
5
2695
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one function to verify the name fields, age, email and gender. My question is: if I create a function for each field like the code below, what would be the best way to organize the functions and call them? Would I need one main function and place...
3
1992
by: PiGei | last post by:
Hi all, I'm trying to build a function that - providing the dbname and the query name - show the results. I don't know how to solve this problem... when I try to insert the variable into this call cnnSimple.x_qry rstSimple
5
1924
by: Matt Clepper | last post by:
Any way to do this? I need to call functions based on a variable. Do I actually have to make a case statement and call each funciton explicitly, or is there any way to call a function where the funciton name is a variable. Example: dim variable as string variable = "thisfunction()" call variable <---this will not work
5
2976
by: Rob | last post by:
Help me, I'm just beginning with programming in Access 2000. I've tried the http://www.mvps.org/access/api/api0001.htm but it won't work in Access. What am i doing wrong. I don't have problems with the http://www.mvps.org/access/api/api0002.htm but it only browse to folders.
24
2633
by: ALI-R | last post by:
Hi All, First of all I think this is gonna be one of those threads :-) since I have bunch of questions which make this very controversial:-0) Ok,Let's see: I was reading an article that When you pass a Value-Type to method call ,Boxing and Unboxing would happen,Consider the following snippet: int a=1355; myMethod(a); ......
5
6552
by: Kurt Van Campenhout | last post by:
Hi, I am trying to get/set Terminal server information in the active directory on a windows 2000 domain. Since the ADSI calls for TS don't work until W2K3, I need to do it myself. I'm fairly new to VB.NET, so I need some help. Here is a code snippit :
7
10070
by: Steve_Black | last post by:
Hello, I'm toying with the idea of loading a MenuStrip (VB.Net 2005) dynamically based on who is logged into my system. Every user has different security settings and I want to customize the main menu instead of showing all possible options and only enabling/disabling certain ones. I have a table that stores the menu item name, parent item (if applicable), display order, etc. so that I can dynamically load my
0
5096
by: mix01 | last post by:
Hi, I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help. Many thanks, Mix01 Version of the program
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7673
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.