We help IT Professionals succeed at work.

ODBC Timeout with Sorted Access Combo Box

557 Views
Last Modified: 2014-08-20
I have encountered a very odd problem.

My client is using SQL Server Express 2014 with Access 2013. Everything works great except for one strange thing. I have a combo box on a form which is used for searching for the product selected in the combo box. The combo box is bound to the primary key field, ProductID, which is hidden. The combo box displays the ProductName which is an nvarchar(35) and is indexed. When I sort on ProductName in the combo box, and the user tries to edit data in the retrieved record, they get an ODBC Timeout error. When I simply remove the sort, making NO other changes, the search works perfectly, and the data can be edited as expected.

I use this identical technique on many other forms, based on many other tables, and it works beautifully.

Has anyone ever experienced this problem?
Comment
Watch Question

Jeffrey CoachmanMIS Liason
CERTIFIED EXPERT
Most Valuable Expert 2012

Commented:
How many products are in the list?

The practical limit for list box items in Access is 1000.
You can change this in the options though...
screen...see if changing this value helps...

JeffCoachman
Dale FyeOwner, Dev-Soln LLC
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2010

Commented:
Alison,

I know you already know this, but the way you describe it above, the combo box you are using to search with is bound, is that what you meant?  

In my experience, the search controls (what ever they are) are generally unbound and have code in the afterupdate event to perform the record search, otherwise, you are simply changing the value of the bound control in the current record.

Dale
CERTIFIED EXPERT
Top Expert 2009

Commented:
From the question, I think this combo box is indeed used to select a new value for a field on the form (it is not a record selector combo box, which should be unbound).  But if not, here is some code for an unbound record selector combo box:
Private Sub cboSelect_AfterUpdate()
'Created by Helen Feddema 29-Apr-2011
'Last modified by Helen Feddema 29-Apr-2011

On Error GoTo ErrorHandler

   Dim strSearch As String

   'For text IDs
   strSearch = "[______ID] = " & Chr$(39) & Me.ActiveControl.Value _
      & Chr$(39)

   'For numeric IDs
   strSearch = "[______ID] = " & Me.ActiveControl.Value

   'Find the record that matches the control
   Me.Recordset.FindFirst strSearch

ErrorHandlerExit:
   Exit Sub

ErrorHandler:
   MsgBox "Error No: " & Err.Number _
      & " in " & Me.ActiveControl.Name & " procedure; " _
      & "Description: " & Err.Description
   Resume ErrorHandlerExit

End Sub

Open in new window

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I guess that I threw everyone of when I said that the combo box is "bound" to the primary key field. What I meant is that the bound column in the combo box is the primary key in the Products table. The combo box itself is UNBOUND and is only used to look up a record from the product table. Sorry for the confusion.

With that said, none of the solutions are applicable except Christian's. I will try it tonight and will report back with the results.

Author

Commented:
Thanks, Christian! That worked like a charm!

Author

Commented:
Thanks, Christian! That worked like a charm!
CERTIFIED EXPERT

Commented:
You're welcome. I had the same problem in my last project with Access and SQL Server with a combobox with xthousand entries used by many users at the same time. Nice side effect of using this is that the scroll bar works immediately and the user do not need to wait until the list is loaded completely.

Cheers,

Christian

Author

Commented:
Hi Christian,

I'm so glad the you encountered this problem and figured it out. I have been using Access since Access 1.1, and have created MANY client/server applications, but have never experienced this behavior before. I'm so glad that the fix was so painless!

Alison
CERTIFIED EXPERT

Commented:
Hi Alison,

in the good old days it was sometimes easier. The number of users was smaller, the amount of data also (OK, the network and computer speed, too...) but in the meantime any new version of Windows and Access adds layers over layers of code (like .NET, like security layers, network security protocol layers, new registry settings, new timeouts and many, many more). So Microsoft is proud to keep the speed of the computer the same since Access 1.1 because the computer gets more and more to do, not often really useful (i.e.: who really needs transparent window frames...?). I would bet that if you would try to do the same with an old Access and Windows version and an old server you would have the same result in a comparable amount of time and without timeout problems....;-)
I would really be interested in comparing the speed of a code which downloads data from a remote system when there's nothing in between of all these layers, only a little bit machine code on both sides.. That must be lightning fast if we compare the speed of a C64 with a modern x-core processor...and I remember that I was really impressed about the speed of my first machine code tries with C64 in 1987.

The world changes, we must, too...

Cheers,

Christian

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.