Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Issues with running database with access 2010 runtime

Posted on 2014-10-23
2
Medium Priority
?
277 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 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

783 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