Solved

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

Posted on 2014-12-10
3
41 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 35

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access - need to reduce row size 25 52
Question about Relationship and Userform in Access Database 17 51
backup programme - VBA 3 24
DCount Type Mismatch 2 21
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

786 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