Run-time error 2110

TheFerrisFile

Registered User.
Local time
Today, 11:56
Joined
Jul 7, 2006
Messages
16
I am trying to set up my form so that when a button is pressed it changes the value of a hidden combo box to another value.

Here is my code so far:

On the button Click event procedure:

Private Sub bttn_date_Click()
Me![ONCLog_DateOut] = Date
Me![Status_ID].SetFocus
End Sub


On the GotFocus event procedure:

Private Sub Status_ID_GotFocus()
Me![Status_ID] = "2"
End Sub


When I press the button it returns a Run-time error 2110 "Can't move the focus to Status_ID"

I have tried rewriting the code several different ways as I am working in Access 2007 and have found that some of my old tricks don't work in '07.

Thanks in advance.
 
What is status_ID (textbox, label, etc)? Is it visible when the code runs?
 
Status_ID is a Combo box that is not visible on the form. I have tried writing some code that makes the combo box visible, then change the value, then back to visible = false. But it still gets caught up on the SetFocus of the button click event procedure.
 
you cant move the focus (setfocus) to a hidden control

what do yuo want to do with the hidden control?

and you cant make it hidden while it has the focus
 
You can't set focus to a control that isn't visible, but you don't have to set focus to it to set a value.
 
The purpose of the Status_ID is to notify the user if a record has been completed.

Status_ID:

1 = Open Review
2 = Completed Review

The user enters all of the information into the main form. When the record is completed, they "log out" the record on another form where they manage their workload. This works fine and the Status_ID is changed to "2" (completed) when the log out button is pressed on the manage workload form.

Here lies the problem, some users open and close a review while on the main form. There is no need for some of them to log in the record, close the main form, open the manage review form, and log out the review.

I would like to be able to have the value of Status_ID on the main form be changed to "2" (completed) when the log out date has been entered by clicking the Date Out button on the main form.

It was mentioned that Status_ID does not need to have focus in order for the value to change? How would I do this?

Thank you.
 
Just use your

Me![Status_ID] = 2

on the click event.

If Status_ID is text then use the quotes. If numeric without.
 
My goodness, that did the trick. It's always the simple ones that get me.

Thanks everyone for your responses and thanks Bob for your help!
 
Glad we could all pull together to help. That's what I love about this site is the number of people who are just wanting to help others.
 
I find the people on this site not only helpful, but understanding in that someone can ask a simple or newbie question and not feel like the dogs will be unleashed.

Thanks again!
 
I used Jon Big Booty's "Dynamic search multiple fields" snippet. Real nice! Just noticed that if I start the search criteria with letter "i" it chokes "error 2110". Weird?? If I use a cap letter "I" and any other letter but "i" it works great.
 

Users who are viewing this thread

Back
Top Bottom