Focus problem, don't understand what the problem is

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have inherited an Access application, and modified it quite a bit. Within
the app, I have a form with a combo box on it, which I populate with a list
of files while the form is loading. When the user clicks on one of the files
(entries) in the list, I read the file name select and process the file,like
this:

Me.cmbTradeReportFileList.SetFocus
sFileName = Me.cmbTradeReportFileList.SelText

The problem is, in a totally unpredictable way, from time to time my users,
when they click on one file name in the list get a fatal error on that saying
something like "you can't get a property or run a method on a control which
doesn't have the focus" !
As I just set the focus in the statement before reading out the selected
entry, I can't understand what and why it is happening.

Can anyone help ? This error is blocking the users completely, and you never
know when it happens.

Thanks for input
Balex
 
All you need is this line

sFileName = Me.cmbTradeReportFileList

without the focus and the SelText, which cause the problem
 
Back
Top