On Change Error on MDE

I have an Access form that I have comboboxes on that allow the user to filter a form.  It is a fe/be application that I publish as an MDE.  The form that works fine as an MDB, but when I create the MDE it displays an error message.

The message only appears when there are no records that match the selection of the comboboxes.

"The expression On Change you entered as the event property setting produced the following error:  You can't reference a property or method for a control unless the control has the focus."

If you click OK to the message, the form continues to work fine.

I need suggestions on how to determine what my problem is.  The MDB does not display the message, so it is hard to know what is going on.


Bob StammOperations ManagerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leigh PurvisDatabase DeveloperCommented:
Does the error occur on your development machine too - as soon as it is converted to an mde?  Or only on the other users machine?
What happens if you temporarily use an mdb on their machine?
(i.e. can you error trap the line - to see what's causing it).

It sounds like you're referencing a control's Text property but it no longer has the focus.
If possible - try to use the Value property (which is the default for the control).
Bob StammOperations ManagerAuthor Commented:
Does the error occur on your development machine too - as soon as it is converted to an mde?  YES

I commented out this statement and the error goes away.

Private Sub cboSubmittedForApproval_Change()
'Me.txtSubmittedForApproval = Me.cboSubmittedForApproval.SelText
End Sub

I have a textbox named txtSubmittedForApproval on the forms page header that I want to fill with the selection of the combobox cboSubmittedForApproval.SelText from the form header.  I am using on On Change to do this.  

Is there a better way?
Leigh PurvisDatabase DeveloperCommented:
And you want it to fill progressively as you type/select?
Rather than just with a finished text value?

Normally you'd just use the Click or Afterupdate event and have

Me.txtSubmittedForApproval = Me.cboSubmittedForApproval

Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Bob StammOperations ManagerAuthor Commented:
Here is my issue.

If I use, I only get the # of the combobox selection.  
Me.txtSubmittedForApproval = Me.cboSubmittedForApproval

I need to know the text that was selected. So I need to use this statement but I still get the errors.
Me.txtSubmittedForApproval = Me.cboSubmittedForApproval.SelText

I placed it back in Afterupdate.  Not sure how to get around this issue.

Additional Ideas?


Leigh PurvisDatabase DeveloperCommented:
Oh right - no problem. I imagine you just need to reference a column in the combo.
Very likely it'll be

Me.txtSubmittedForApproval = Me.cboSubmittedForApproval.Column(1)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob StammOperations ManagerAuthor Commented:
That was it.  You showed me somthing new.  Was not aware of .Column(1) option.

Thank you for your help!!

Bob
Leigh PurvisDatabase DeveloperCommented:
Welcome :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.