VBA not running in after update event. Run-time error '2113'

I have a sample database set up in access 2007 and please see the attached.

There is VBA code behind ED_disposition field in the after update event.

When I change its value, I keep getting a run-time error "2113", saying the value you entered isn't valid for this field.

I am not sure what my problem is. Does this have to do with table level look up again?

Also, is it legitimate to write 3 if statements the way I did in the code? They are basically 3 scenario checks

Sponsored Links:

Related Topics

Error "Run-time error '1004': General ODBC Error
I'm having trouble running a file that I run weekly, when running the update query I receive error message: "Run-time error '1004': General ODBC Error

When I run debug, it fails at the 2nd line of code below:
....

My excel links the CCL data from Access via the below details and from what I know, nothing has changed. I've googled the error and it seems to mention an awful lot that there could be a problem with the link but I'm very inexperienced with Access and not quite sure where I should be looking.


Error Message when running 'On Load' VBA code / Macro
I've entered some code in the 'On Load' portion of my main form, designed to pop up a confirmation dialog asking the user if they want to run a macro to update the DB's tables with current data from some linked tables. when loading the form, however, I get this message:

The expression On Load you entered as the event property setting produced the following error: A problem occurred while was communicating with the OLE server or ActiveX Control.

* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event, or macro.

in addition, the "Show Help" button on this error message gives the following information:

This error occurs when an event has failed to run because Microsoft Office Access cannot evaluate the location of the logic for the event. For example, if the OnOpen property of a form is set to =[Field], this error occurs because Access expects a macro or event name to run when the event is fired.

I don't really understand what this means, to be honest. the same code/macro combo worked perfectly fine on another form I created (and subsequently lost, which is why I'm recreating it).


Can't Assign a Value.
In Access 2010, when trying to assign a textbox a value using VBA code I'm presented with this error:

Quote:

Run-time error '-2147352567 (80020009)':
You can't assign a value to this object.

What I'm trying to do is record the date and time whenever a record is modified. I'm using the "Before Update" event to run the following code:
....

I don't know why it won't work. This is something that seems about as simple as it gets. I've Googled the error and everyone is suggesting missing references and untrusted locations as thecause but neither of those apply to this as I have no missing references and the location is trusted.


VBA to update field contents...Error 91
I know this is probably something basic but my VBA knowlege is pretty limited. I am trying to update a field After Update in a form using the following code but getting an error message - "Run-time error '91': Object variable or With block variable not set"...


Run time error
I had running program which a data can be exported to excel. using the outputto command. It give a runtime error: "the expression may not result in the name of a macro, the name of a use defined function, or [Event Procedure] here may have been error evaluating the function event, or macro." on a new laptop where it is running windows 7 home edition and office 2003. But when I run the program on my pc, windows 7 also and access 2003, no problem


Run time error
I had running program which a data can be exported to excel. using the outputto command. It give a runtime error: "the expression may not result in the name of a macro, the name of ause defined function, or [Event Procedure] here may have been error evaluating the function event, or macro." on a new laptop where it is running windows 7 home edition and office 2003.But when I run the program on my pc, windows 7 also and access 2003, no problem.


After update of check box gives error
I have a check box on a form and was trying to write code for the after_update event.

"The expression After Update you entered as the event property setting produced the following error: A problem occurred while Genetic Disease Database was communicating with the OLE Server or Active X control"

Not sure why this is occurring.
....
and in the property of the check box is Event - after update : is [event procedure]

Haven't had trouble like this elsewhere.

I tried commenting out the code and still get the error. I tried a new check box and still get the error.
I tried the code in "on click" and still got the error.

Can you not have any event procedures for a check box? How am I supposed to handle this in VBA? I need to do is open a new form if check box is checked.


Running an Update Query from Excel
I’ve done a whole load of searching and come to a dead end regarding running an Update Query from Excel.

I have 35 fields in my Update Query, with each one having an ‘IIf’ formula. My Excel sheet if populated using SQl linked to Access. I then add figures required and run the Update query.

I would ideally like run some VBA that runs the Update Query. But it seams so complicated.


Timed events
I am trying to build a database for a Biathlon event organizer. I can figure out what format or data type to designate a control for a final time such as 53:21 meaning 53 minutes and 21 seconds to finish the course. Also, I need to program some calculations so that we can subtract one event time from another to get the split time. In other words, we record someone's run time and their total time (running and biking), but to get the split time on the bike portion I need to be able to subtract the run time from the total time. Does Access have a provision for this keeping in mind that regular math won't work because a minute is 60 seconds long (not 100)?


2113 Error happening from Access 2003 to 2010
I'm just filling in for the "Access" guy that left the company. I have a .mdb that works fine in Access 2003. I get a 2113 error, "The value you entered isn't valid for this field.", in Access 2010.
This error happens when I do the following.

1) Select an item from a combo box. (data from another table)
2) Next, click a button to open another form.
3) This action should take the data from the combo box, then query a table for info that will be displayed in the next form.

Like I said earlier, it works great in 2003. I've been told that it may be a reference issue.


Custom Error-Handling (Run-Time Error '490')
I have a command button that opens PDF files stored in multiple folders, but I'm trying to create a customized error-handling message to replace the "Run-Time Error '490'" error that is displayed when the database cannot find the specified file.

Since I'm pretty sure that this procedure needs to be coded with the OnClick event, I'd like to create a vbOKonly message that tells users the PDF file does not exist because the criteria on the FollowHyperlink string is not met.

I have a small grasp of error-handling, but I can't seem to complete the full procedure and resume normal functions (due to the VBA syntax errors I keep stumbling on


Scheduling Updates On Timer (ARRGH!!)
I have a db which is split front and back and is deployed via RDS to quite a few users.

The problem I have is, a function which is used a lot triggers a series of queries which on their own run fine, however as it's used by about 10 users it's causing the db to crash.

The queries which are running only need to be ran once every 5 minutes or so, so, what I'm looking to do is scheduale a SINGLE update to happend every 5 mins so that only one event of th query happens.

The only way I can think to do this is to have a manager (1 user only) open a form in the background which triggers the event every 5 mins (not sure how to run a macro on a loop on timer in VBA).

Does anyone have any better ways? (If my rambling above makes any sense


Excel remaining open after many varying attempts to write quit via Access VBA
Which outputs a couple of reports, then opens one back up to re-format in excel and save/close. It all looks great, but two things happen.

The first is that after running successfully the first time, when trying to run again it falls over and gives me the 'run time error 91 object variable or With block variable not set'

I then debug and it takes me to the line I have shown in red.

I then close the excel sheet which has opened, manually, and close the debugger, and run the report, which then works. (however, I can see from task manager that excel is remaining in RAM,hence if I try the access VBA again it falls over)

Whats missing from my code to get Excel to close properly each and every time the VBA executes!?


Run time error 7878
I'm relatively new to access and i've just designed a database using some vba code. Sometimes when I'm using a form an error box comes up saying run time error 7878. What does this error mean?
Its not causing a major functionality issue but it does make it a lot easier for users to get to the coding through the debug button which I don't want to happen


Handle Run-Time Errors in VBA
When you are programming an application, you need to consider what happens when an error occurs. An error can occur in your application for one of two of reasons. First, some condition at the time the application is running makes otherwise valid code fail. For example, if your code attempts to open a table that the user has deleted, an error occurs. Second, your code may contain improper logic that prevents it from doing what you intended. For example, an error occurs if your code attempts to divide a value by zero. Learn how to trap run-time errors.


Run-time Error 2465: Access can't find the field 'sfrLeave' referred to in your expr.
I am an intermediate user of Access and know next to nothing about VBA. After modifying an existing subform in my database, I started getting run-time error '2465' every time I try to open The form which contains that subform.

When I click 'debug' it opens the VBA environment and shows exacltly where the "sfrLeave" is referred to in the code, but I don't know how to fix it and am afraid I will make more damage.

Can anyone help me? Can this problem be fixed without messing with the VBA


Running VBA on a timer
I have a piece of VBA on a form that I run manually from a command button, but I want to run this using a timer event.

I also want to change the timer (its a field on the form) as and when and this automatically updates the timer event, how do I do this please


GotFocus event not running
I'm trying to run a 'GotFocus' event on one of the text boxes on my form.

Here's the code in progress:

Private Sub txtCINAME_GotFocus()
MsgBox "got focus" End Sub

When I click on the text box, it's not running at all!
I've tried adding a GotFocus event to other text boxes too, with just a msgbox & they're not running either.

I've checked the properties & the event is definitely linked to the text box.

Any ideas why or what I could have done to stop this event from running?


Executing update: Run-time error '3061': Too few parameters. Expected 1
I've got a form where a customer can place an order. now at the bottom i want to put an execute statement which will look at the product ID that has been ordered and make sure that it dont allow that one to be entered again. This is the coding I've got atm to do that:

db.Execute "UPDATE tblProduct SET chosen = True WHERE ProductID = " & cmbProductID

The error message im getting is:
Run-time error '3061': Too few parameters. Expected 1.


VBA code to check for updated front-end
I have a front-end database that I deploy to a team. From time to time I need to re-deploy an updated front-end, to add features or fix bugs. Currently that involves me either manuallyupdating everyone, or sending instructions around that some of the less tech-savvy folks have trouble following.

I thought of trying to build in an auto-update feature into my front-end (that could run on the Form_Load event), but not clear on how it might work. I definitely know how to code it so that it would look for a more recent version of the front-end on the network drive and copy the updated front-end to the user's local machine if it found an update.

But is there a way tohave the old front-end (which is the one that is open and running the code) close itself and delete itself, and then to launch the new front-end?