Link to home
Start Free TrialLog in
Avatar of Bob Stamm
Bob StammFlag for United States of America

asked on

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.


Avatar of Leigh Purvis
Leigh Purvis
Flag of United Kingdom of Great Britain and Northern Ireland image

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).
Avatar of Bob Stamm

ASKER

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?
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

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?


ASKER CERTIFIED SOLUTION
Avatar of Leigh Purvis
Leigh Purvis
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That was it.  You showed me somthing new.  Was not aware of .Column(1) option.

Thank you for your help!!

Bob
Welcome :-)