Senseless error

M

Mark A. Sam

I have this code in the Change event of a combobox:

Private Sub Location_Change()
'On Error Resume Next

If [Location].Text = "" Then
[Location] = "All"
End If


End Sub

It gives me err 2185

"You can't reference a property or method for a control unless the control
has the focus."

Obviously the contol has the focus since I changed its value and nothing
else changes the focus from this control.

I use this exact method in another app and it works fine.

Any ideas on this?

Thank you and God Bless,

Mark A. Sam
 
A

Allen Browne

If a form has no record and no new record can be added, the Detail section
goes completely blank, but the controls in the Form Header and Form Footer
sections are still visible. When this happens, Access has a bug that causes
it to get throughly confused about how to display values and what has focus.

Is that the case you are seeing? More info in:
Incorrect display of data
at:
http://members.iinet.net.au/~allenbrowne/bug-06.html

If that's not the issue, is there any more info you can give?
 
M

Mark A. Sam

Hello Allen,

The form has a recordset, I was running the AfterUpdate event from the
OnChange which ran an OnClick of a button. I moved the AfterUpdate code to
the OnChange which solved it.

Thanks for the feedback. I helped me figure out the problem even though it
wasn't the solution.

God Bless you brother.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top