Solved

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

Posted on 2014-12-10
3
54 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 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 37

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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 Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

705 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