Solved

I cannot assign a user-defined function to the onclick event.

Posted on 2014-12-10
3
47 Views
Last Modified: 2016-07-12
I am building a web application on access 2010. It somehow needs to be compatible with access 2007. I am having web compatibality problems with events that cannot be used. If there is a work around, so I can use the click event for controls.
I have tried to create a macro to call the function to vain.
I have tried using the below code to no positive result

With Forms("CreateReports").Controls("BtnWork")
.OnClick = "= btntry()"
End With
I even tried to include the location of the function (forms("CreateReports").btntry(), but doesn't work
.The error I get is :
'The expression onclick you entered as the event property setting produced the following error. the function you entered can't be used in this expression.
This error occurs when an event has failed to run because the location of the logic for the event cannot be evaluated. For example, if the OnOpen property of a form is set to =[Field], this error occurs because a macro or event name is expected to run when the event occurs.'

the function is simple and defined as follows:
Public Function btntry()
MsgBox "work"
End Function

Thanks
0
Comment
Question by:bhuvana dhruva
3 Comments
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 250 total points
ID: 40491014
Answer is basically no.

In Access web apps, there is no VBA and limited events for controls because running an app within a web browser is just different.

With web apps, everything is done through macro's.

You will not be able to do many of the things you do in a desktop DB.

Jim.
0
 
LVL 36

Accepted Solution

by:
PatHartman earned 250 total points
ID: 40491510
Also,
Web apps were completely redefined in A2013 and earlier attempts have been deprecated which means that you are developing in technology that is already dead.  So, if you do need to create a web app:
1. make sure you are choosing that technology for the right reason (Employees need access to the application from remote locations)
2. make sure you determine if web apps can support all the functionality you need -they are quite limited, starting with not supporting ANY programming language.  You can only use macros.
3. Use A2013 and the latest version of SharePoint.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

680 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