473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Combo box on subform retains values from previous records

Dear All,

First of all I would like to take the time to thank you all for your efforts and time spent at this wonderful forum. I have found it very helpful with numerous examples available for every level of user.

I am facing a rather weird behaviour with a combo box on a subform (Continuous form).
I have two tables. Order and Order_Details. The master form is based on the Orders tables and the details form (subform) is based on the Order_Details table.

On the main form, I have a field called Country. Each order record is placed for a country. Each country has a list of products available, with different prices. In other words, for Country A, Product A can cost 20 Euro, while in Country B Product A can cost 19.5 Euro. Also, in Country A Product B is available while in Country B Product B is not available.

Based on this information, as soon as the user enters the required data in the main form, I force them to save the record in order to display the continuous form, thus in case the user cancels while entering Order_Details, I avoid the scenario of having orphan Order_Detail records.

On the subform, the user then has to select a product from a combo box. I load the combo box with the list of products available for the country specified on the main form. All is fine when creating the record.

Whilst in edit mode, the user views Order 1 with its respective details, then clicks on the navigation button at the bottom of the form, and jumps to view Order 2 etc etc.

If the user clicks on the Product combo box any of the Order_Detail records from Order 1, this will load the combo box with the list of available products for the country on the main form. So far so good. However, if the user then clicks on the navigation button and jumps to Order 2 and then again clicks on the Product combo box, the weird scenario occurs. The combo box still retains the values of products that were loaded for Order 1. It does not refresh the list.

Essentially it loads the list on the first Order records that I attempt to edit and it retains it until I close the form and re-open it.

I have tried to reload using the Me.Requery command on the Got focus event but it doesnt seem to be executed. Same thing for the On click event.

Any ideas what causes this behaviour and mostly, how can I solve it ?

Kind Regards
Virtualgreek
Mar 8 '07 #1
4 2882
MSeda
159 Expert 100+
Try in the main forms onCurrent event
me.DetailSub.Form.ProductCombo.Requery

(of course change the object names to match the ones on your form)

This will specifically requery the combo box when the user selects another order on the main form.
Mar 9 '07 #2
Try in the main forms onCurrent event
me.DetailSub.Form.ProductCombo.Requery

(of course change the object names to match the ones on your form)

This will specifically requery the combo box when the user selects another order on the main form.
MSeda, thanks for the reply.

I have tried the following on the main form (Orders), current event.

Me.frmOrderDetails.Form.cboProduct.requery

but it didnt work. Apparently it cannot reference the subform at that point or the syntax is incorrect.

On the other hand I have tried the command Me.frmOrderDetails.Form.Requery seems to work. (at the same event). But I havent tested it for any 'side effects'.

If I requery the whole subform, do you anticipate and performace problems ?

Kind Regards
Virtualgreek
Mar 9 '07 #3
MSeda
159 Expert 100+
I'm not sure why the combo won't requery the syntax looks correct assuming the form and combo box names are spelled correctly. I don't see any thing in your description that would indicate that this might not work.

Apparently it cannot reference the subform at that point or the syntax is incorrect.
Do you get an error message telling you this or the combo just doesn't update?

It would be preferable to only requery the combo box since the form has updated via the link fields. Requerying the entire subform isn't a terrible thing, but it will take slightly longer than requerying the combo only.
Mar 9 '07 #4
Mseda, thanks again for your reply.

I will check the names and try it again.

In the meantime my temp solution has worked, and it doesnt seem to cause a problem regarding performace, since an Order doesnt really have that many Order_Detail records.

Thanks again.
Virtualgreek
Mar 9 '07 #5

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

Similar topics

25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
1
by: BigJay | last post by:
I am 1. trying to have a combobox used as a selector to display records in a subform. and not sure on how to get selected info into subform.the combo is populated but can not get subform updated...
7
by: badboybrown | last post by:
I know that this is an age old question and it has been approached a few times, but I've hit a wall and require some help. I have various combo boxes that contain values that are both "current"...
1
by: lawton | last post by:
Source: this is an access 2003 question My knowledge level: reading books, internet, and trial & error; no formal training I'm trying to get a running sum of what's filtered in a subform which is...
1
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a...
0
by: vljones | last post by:
Hoping to find a way of entering new data into a combo box which contains a list of items contained in a table. In addition I want to allocate an ID number to entries that are not currently in...
14
kcdoell
by: kcdoell | last post by:
Hello: I have a form (Default view =single form) with a subform (Default view =continuous forms) embedded into it. In the form I have three controls that display the Division, Working Region &...
5
by: jaynea | last post by:
Hi I have a main form which contains questions and a subform within it which contains elements which relate to the main form. they are linked by a field called question_ref so if I page through the...
18
by: Richard Penfold | last post by:
I have a form with a subform in my database that I use to manage deliveries. A combo box on the subform displays items of inventory and thier current status. The code behind the combo box is......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...

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.