Stepping thru code has given different results than having the code run without a breakpoint.Īlso, exiting the Sub OnClick. Access is then confused about where the focus should be. If the code window is open, as it usually is in program development, then that window can get the focus. In the year since I posted this thread, I have discovered a couple of things that may affect focus. My form in one database has 22 textboxes on 13 tabs that are monitored for change, and test the value in. When creating a form that will never have any bound controls, such as my "Filter" form, I routinely set the "Allow. No record, and can't add record, so where is it supposed to be putting the input?
I can see where Access can't give focus to a control bound to nothing. If the AllowAdditions is getting in the way when the form data is empty, then this is a completely different problem.
I am going to stick with the Full Moon idea for my issue. It's MY code, and I'm trying to generate MY "Look and Feel".Īnyway, thanks very much for looking at the problem. Some of my posts have gone off-topic when ideas are posted about having my code do something other than what I want. When I search for answers before posting questions, I find a lot of posters, on many forums, trying to explain their company's business plan, or internal workings. If it is necessary, I don't mind at all posting the actual code.
I have 2 reasons for this: 1) I don't want to waste anybody's time trying to understand what my program is about, and 2) I don't want the thread to get off-topic. When I present a problem to this forum, I try to remove anything I don't think is germain to the issue. I certainly copied EVERYTHING EXCEPT the one TextBox Control, which was recreated, but the code is identical, and so are all the properties. But honestly, I have no Idea what is different here from the old form. Now that I know that Microsoft Access has bugs, I can blame everything on them. So I started again, and copied all controls except the TextBox, which I built from scratch using the toolbox. Starting again, with a new form, I copied all the controls and code to the new form, and error '2185' occurred. Now when you run your VBA code, the "Object required" error should no longer appear.I then created a new form, from scratch, with only a TextBox, and of course, this code worked, as I stated in my original post. We've just chosen the form's "On Open" event for demonstration purposes. You can actually fix this error by invoking the Code Builder on any event in the form (or any one of the objects on the form). Now when you return to the Visual Basic editor, form1 would appear in the list. When the Choose Builder window appears, select Code Builder and click on the OK button. Click on the button (with the three dots) on the "On Open" event for the form. Next, display the properties for the Form object. To fix this problem, we'll open form1 in design view. When we take a look at the Visual Basic editor, we can see that form2 exists, but we can't see form1. In our database, we've created two forms - one called form1 and another called form2. In fact, the Visual Basic editor will not recognize your form until you've invoked the Code Builder (for your form or any object on your form) at least once. What am I doing wrong?Īnswer: The problem isn't your code, it's that the Visual Basic editor does not recognize your form. The object that I'm referencing is valid and it should work. I can't seem to figure out why it won't work. Question: In Microsoft Access 2003/XP/2000/97, I'm using VBA code to set a value on another form and I keep getting a " Run-time error '424': Object Required" error.
This MSAccess tutorial explains how to fix the Run-time error '424': Object Required error in Access 2003 (with screenshots and step-by-step instructions). MS Access 2003: Run-time error 424 (Object Required)