474,044 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ACCESS 2000: Problem Calling Sub using the eval method

I have a form with 100 images (named from img1 to img100) and a Click
event associated to each one.
I want to write a function that calls these events.

I have tried the following:

Dim imgEvent as Variant
For i = 1 to 100
imgEvent = "img" & Format$(i) & "_Click" 'Create image name.
Call Eval(imgEvent)
'Call Eval(Me(eval(im gEvent))) 'Didn't work either
'Call Eval(Me!eval(im gEvent)) 'Didn't work either
Next i

The only thing I get is an 2482 error (Could not find the name
'img1_Click').

I AM DESPARATE!!!!!! !!!!!!!!!!!!!!! !!
I have looked everywhere and couldn't find a thing!
P L E A S E H E L P M E ! ! ! ! !
Nov 13 '05 #1
2 1673
Kostis,
To what end? Why loop through the image frames? If you made a one-time
pass through the frames and set an action to the click event of each, would
you not accomplish the same thing? Ok, mebbe it ain't as pretty, but it
would get the job done.

"Kostis" <ne*********@ho tmail.com> wrote in message
news:65******** *************** ***@posting.goo gle.com...
I have a form with 100 images (named from img1 to img100) and a Click
event associated to each one.
I want to write a function that calls these events.

I have tried the following:

Dim imgEvent as Variant
For i = 1 to 100
imgEvent = "img" & Format$(i) & "_Click" 'Create image name.
Call Eval(imgEvent)
'Call Eval(Me(eval(im gEvent))) 'Didn't work either
'Call Eval(Me!eval(im gEvent)) 'Didn't work either
Next i

The only thing I get is an 2482 error (Could not find the name
'img1_Click').

I AM DESPARATE!!!!!! !!!!!!!!!!!!!!! !!
I have looked everywhere and couldn't find a thing!
P L E A S E H E L P M E ! ! ! ! !

Nov 13 '05 #2
Not sure if you can do what you ask, but you can programmaticall y assign a
function name to the OnClick property of each control.

This example assumes you want to call a function called MyProc1() for img1,
MyProc2() for img2, etc.

Dim ctl As Control
Dim strForm As String
Dim strFuncName As String

strForm = "NameOfYourForm Here"
DoCmd.OpenForm strForm, acDesign, WindowMode:=acH idden
With Forms(strForm)
For Each ctl in .Controls
If ctl.ControlType = acImage Then
strFuncName = "=MyProc" & Mid(ctl.Name, 4) & "()"
ctl.OnClick = strFuncName
End If
Next
End With

Set ctl = Nothing
DoCmd.Close acForm, strForm, acSaveYes

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Kostis" <ne*********@ho tmail.com> wrote in message
news:65******** *************** ***@posting.goo gle.com...
I have a form with 100 images (named from img1 to img100) and a Click
event associated to each one.
I want to write a function that calls these events.

I have tried the following:

Dim imgEvent as Variant
For i = 1 to 100
imgEvent = "img" & Format$(i) & "_Click" 'Create image name.
Call Eval(imgEvent)
'Call Eval(Me(eval(im gEvent))) 'Didn't work either
'Call Eval(Me!eval(im gEvent)) 'Didn't work either
Next i

The only thing I get is an 2482 error (Could not find the name
'img1_Click').

I AM DESPARATE!!!!!! !!!!!!!!!!!!!!! !!
I have looked everywhere and couldn't find a thing!
P L E A S E H E L P M E ! ! ! ! !

Nov 13 '05 #3

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

Similar topics

2
3524
by: Pete | last post by:
In Access 95/97 I used to be able to create pull down menus (File,Edit ...) from a macro. It seems there used to be some wizard for that. However in Access 2000 it seems you have to build your menus by customizing a toolbar. With this method you have to create a separate macro for every single menu and sub menu. The old method would allow me to include several menus (File/ print/ page setup ...) all within one macro. Now it seems I...
7
8902
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
9
4340
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access application as the data source, and then performs a merge. Everything works fine. However, when a user uses it in Access 2002 and Word 2002, an extra instance of the Access application is opened and remains open at the end. Sometimes it remains open
11
6645
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
29
15601
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ---Start of test.aspx---- <%@ Page language="C#" AutoEventWireup="false" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD>
2
9646
by: | last post by:
I've defined an ObjectDataSource against a dataset, and I can bind the ObjectDataSource's members to data controls. I'm wondering how to take the values in an ObjectDataSource and programmatically manipulate them before they're bound to any data control. I'd be using them almost like you'd use recordset fields from Classic ADO. In other words, I would like to grab the value corresponding to a publication date from my database, use the...
4
3560
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the application initially. I have VS 2002, Windows XP, Access XP(2000 format). He is my problem....
7
402
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I access a property of an object using a string? ----------------------------------------------------------------------- There are two ways to access properties: the dot notation and the square bracket notation. What you are looking for is the square bracket notation in which the dot, and the identifier to its right, are replaced with a set of...
2
4547
by: ilany | last post by:
Hi to all... Would greatly appreciate any suggestions. I'm trying to evaluate an expression during run-time that looks something like this: Eval("RecordAdd_Addresses(False,"John","","Doe","New York","NY","11216","US","12345678","","",Empty,Empty,Empty)") I get this error:
0
10544
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
11601
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
11138
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...
0
10308
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7867
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
6652
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...
0
6836
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4943
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3970
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.