Solved

Issues with running database with access 2010 runtime

Posted on 2014-10-23
2
238 Views
Last Modified: 2014-10-26
I have a Access 2010 database with front-end and back-end. In normal configuration front-end is .accdb it works very well.
However when I change it to .accdr or open it with A2010 runtime it has issues.
Please help me with one issue and then I may understand what the problem is.
In the form below, when I select a "new activity" (red arrow) from the dropdown box, I get a message that a runtime error has occurred and the system will shut down.
That combobox has after update code associated which changes the date value in the "Date to Complete task" textbox.
Can a database not run code in the A2010 runtime?
Please look at my code below. Is there anything there that does not run in a runtime. It looks straight forward to me and it runs nicely in normal Access 2010

Where the problem starts.
Private Sub tbxActivity_AfterUpdate()
Dim lngDays As Long
Dim strMeActivity As String
Dim strWhere As String

    On Error GoTo UnknownActivity
    lngDays = DLookup("[NormalDaysRequired]", "tblActivities", "Description = '" & Me![Activity] & "'")
    tbxDateToComplete = tbxDateCreated + lngDays
End

GoTo Completed
UnknownActivity:
    tbxDateToComplete = tbxDateCreated + 1

Completed:
End Sub

Open in new window

0
Comment
Question by:Fritz Paul
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40400066
Could be a number of things ... for example, your tbxDateCreated might be NULL, or something of that nature, or the DLookup might not return a value.

Also, you must handle all errors in a Runtime application, else you run the risk of this sort of thing happening. When running in full Access, your errors would be handled by Access, but you don't have that protection in the Runtime (or when running as an accdr). If the Runtime comes across an unhandled error, it just shuts things down.

I would also STRONGLY advise you to get away from GoTo coding, except for use with error handling. That sort of coding went out with QBasic, and can become extremely difficult to troubleshoot down the road.
0
 

Author Closing Comment

by:Fritz Paul
ID: 40405747
Thanks for the reaction to my question.

It was the first time that I gave someone a database to run under Access runtime, so I could not understand why the program just shut down.
After I read the answer, I went back to investigate. I added messages to show me the values the program was working with and added some error traps. I also got rid of the "Go To" code as suggested. I also located some more potential "issues" and fixed them.
Although I initially felt that the answer was a little blunt, I now appreciate the fact that it did lead me in the right direction and that I got the confidence to go forward.

The program is now running smoothly.

Thanks.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now