?
Solved

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

Posted on 2014-12-10
3
Medium Priority
?
58 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 58

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 1000 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 38

Accepted Solution

by:
PatHartman earned 1000 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

752 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