Solved

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

Posted on 2014-12-10
3
31 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 34

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
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.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now