473,499 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

auto expand on combo box with autofill VBA format issue stops auto expanding

4 New Member
I have created a form that has a combo box and that combo box has VBA code that gets other fields to autofill but the problem is my combo box no longer auto expands as I type in in my case a book title into the combo box. I have narrowed the issue down to the price field it has something to do with the currency format.

If I remove it from the code and the auto expand works again and all field bar price autofill. the number format field doesn't cause any issues just the price.

I have tinkered further and I think it is to do more with the fact the price field is used in a calculated field sub total field [price]*[quantity].
May 4 '14 #1
6 2168
jimatqsi
1,271 Recognized Expert Top Contributor
Dgreenwood,
Welcome to Bytes.

You need to do a better job of explaining your problem and what you have done so far. You're typing a book title and you think the price field has something do with the list of book titles not auto-expanding? You have to help us make sense of that because we can't possibly guess what the connection is between those two.

"If I remove it from the code and the auto expand works again ..."
What is "it", currency formatting? Again, what has currency formatting to do with book titles?

"all field bar price autofill. " What are you saying here? You have multiple columns in your combobox and the column for price is not filling in? Or you have multiple combo boxes and the combo box for price does not work?

Please show us the any code you have. And what version of Access are you using? Be clear about what you have and what does not work.

Jim
May 4 '14 #2
Dgreenwood
4 New Member
Sorry,

Microsoft Access 2010

In my Form "Book Purchase" I have the following fields Autofilling from a comboBox field called "search" that has all the information linked via lookup wizard from the "Books" table.
ISBN Number (PK)
Title (of the Book)
Number in stock
Price

The code used to autofill the fields and is currently working fine is.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmoSearch_Change()
  2. Me.txtTitle.Value = Me.cmoSearch.Column(1)
  3. Me.txtISBN_Number.Value = Me.cmoSearch.Column(0)
  4. Me.txtNumber_in_Stock.Value = Me.cmoSearch.Column(2)
  5. Me.txtPrice.Value = Me.cmoSearch.Column(3)
  6. End Sub
There are 2 other fields in the form
Quantity (user selects how many to purchase)
Sub Total (calculated field [price]*[quantity])

all the fields autofill fine the comboBox will only let me type in 1 letter and will auto fill the information into the relevant fields. So no expanding I have to use the drop down.

If I remove the line of code the autofills price the comboBox works perfectly and all the fields left in the code autofill perfectly.

I hope that is clearer



Attached Images
File Type: jpg form_Issues.jpg (38.4 KB, 683 views)
File Type: jpg relationships.jpg (43.3 KB, 781 views)
May 4 '14 #3
jimatqsi
1,271 Recognized Expert Top Contributor
That is clearer, but still not clear. All was good until the last bit. "If I remove the line of code the autofills price the comboBox works perfectly and all the fields left in the code autofill perfectly."

Are you saying that if you remove
Expand|Select|Wrap|Line Numbers
  1. Me.txtPrice.Value = Me.cmoSearch.Column(3)
then one of your combo boxes works better?

I don't really think that is the case. If that is what you think you see, I think you should look closer at what is happening. If txtPrice is really just a text box then I don't think filling it will change the behavior of a combo box.

I could be wrong, but I encourage to fiddle with it a while and see if something obvious doesn't bubble up to the surface.

Also, be sure to use code tags when you post code. Click the [CODE/] button and paste your code between the tags.

Jim
May 4 '14 #4
Dgreenwood
4 New Member
I have had a good tinker and the "Sub Total" field in the "Book Purchase" table is causing the problem (which is in the form "book Purchase" but is the source of the data.

It is a calculated field and when I have removed the calculation format the Combo Box for "select" works fine but the subtotal no longer works obviously.

I have had a look on the settings and can't see anything but I am guessing that as soon as I press a letter in the combo Box the fields auto fill and then the subtotal has data to make its calculation and prevents the auto expand from working. It simply enters the first result under the letter pressed.

the VBA code is built on the event "on Change" should this be moved to something else?
May 5 '14 #5
Dgreenwood
4 New Member
Moved the event to "after update" and it works go me!
May 5 '14 #6
jimatqsi
1,271 Recognized Expert Top Contributor
Yes, you made exactly the right move. OnChange is fired after every change within the value, OnUpdate is fired after the edit of the field is completed.

Good job!

Jim
May 5 '14 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2071
by: Jim Devenish | last post by:
I have a combo box with Auto Expand and Limit to List both set to 'yes'. When I type 'C' I correctly get: C J Valeting When I type 'CO' I get: Cogent Seating Ltd again correct BUT when I go...
3
2574
by: Joey Powell | last post by:
Is it possible to specify a format string for one or more auto-generated datagrid columns? If so, could someone post an example? More specifically, I am interested in taking output like 27.0800000...
1
2674
by: pemigh | last post by:
In a prior posting (too old to reply directly), Jim Devenish described exactly what my client has seen, both in terms of AutoExpand behaving oddly and the way that caps lock relates to the...
3
7856
by: joseph.mccastlain | last post by:
Hello All, I am a new user to Access. I am currently designing a database consisting of four tables for multiple users. Rather than bore you with the goals and such, here is what I am...
4
14161
by: magmike | last post by:
I've got a control on my form that allows the user to select a record based on a form field (in this example, the drop down menu shows the company name, followed by the contact name but uses the...
3
3225
klarae99
by: klarae99 | last post by:
Hello, I am using Access 2003 to design an inventory database. Please be pacient with this question, I am not sure how exactly to explain what is happening concisely but I will do my best. I...
3
17214
by: Simon van Beek | last post by:
Dear reader, What can be wrong in my ComboBox, the property "Auto Expand" is set to Yes, but by typing in the ComboBox it doesn't expand. Is this because the source of the ComboBox is a...
1
4440
by: janakrai | last post by:
how to auto expand drop down combo box in onfocus event like click event
7
2455
by: dorandoran | last post by:
I used this article (http://www.codeproject.com/KB/webforms/EditNestedGridView.aspx) to accomplish expand/collaspe grid. I also added a search and it works. but i need to be now automatically expand...
1
1573
by: Kanapaha | last post by:
Initially the combo box (cboSearchName) was working fine but for no apparent reason it now works for only the first two characters typed. In other words, if I have the names Smith and Small; Small...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.