473,498 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Combo Box On Main Form From Secondary Form

52 New Member
Hi Everyone,

I have a form “FormMain” on which i have a combo box which pulls values from a table. If the combo box does not have the choice the user is looking for, i added a button that opens a form “FormPopAdd” where the user can enter a new record for that combo box (the user must use a command button to save the new record). Once the user clicks the save button on the FormPopAdd form I have a piece of code that refreshes the original form FormMain behind the pop up form so that the new record can be found in the combo box:

If CurrentProject.AllForms("FormMain").IsLoaded Then
Forms("FormMain").Refresh
End If

This works well if the user has not yet made any changes to the record on FormMain, if the user has made changes, once the code runs, the record is saved – I don’t want that. What I need is for the combo box to be updated on FormMain and not the entire record. How is that Done?

I know it’s a little long, but if you can get me any ideas, I would really appreciate it.

Thanks
May 22 '08 #1
3 2042
Megalog
378 Recognized Expert Contributor
Greets Darnnnel,

So instead of refreshing the entire form, you really only need to requery the combo box itself. This wont save your form's active record changes, it will just refresh the combo box's choices. Change what you're using currently, to:

Expand|Select|Wrap|Line Numbers
  1. If CurrentProject.AllForms("FormMain").IsLoaded Then
  2.       [Forms]![FormMain]![YourComboBoxName].Requery
  3. End If
That should be all you need.
May 22 '08 #2
darnnnel
52 New Member
Megalog,

You are a life saver, thanks very much it worked very well.

Leon
May 22 '08 #3
Megalog
378 Recognized Expert Contributor
Glad to help! Figuring out which syntax, property, or command to use use can be troubling sometimes, when you've no example to follow from the past.

Have fun!
May 22 '08 #4

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

Similar topics

0
3492
by: Krisa | last post by:
Hello all, I just discovered something (stop me if you've heard this before....) that was causing me a significant performance hit when opening a form with subforms. To speed up loading the...
5
3292
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the...
8
18301
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". ...
3
3755
by: Dale Lundgren | last post by:
I have a c# class library that launches a Win Form in a secondary thread. From the Form (now running in the secondary thread) I need to be able to start a method that is defined in the class and...
1
9147
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the...
1
3081
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...
0
996
by: =?Utf-8?B?RWRC?= | last post by:
I have a main form that gets brought up once and a secondary form that the main form may call and open repeatedly. The secondary form contains 7 combo boxes, one for each day of the week, each of...
4
3015
by: Swinky | last post by:
I am trying to make a combo box dependent on a text box. I cannot get the combo box to pull the related data from the text box. I have been all over this user group & have tried several versions...
12
2114
by: Richard Penfold | last post by:
I have a form with a subform containing the combo box I want to update. I have a command button in the header of the main form that launches a report in print preview mode. I want to update the...
0
7005
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
7168
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
7210
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
6891
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
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1424
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 ...
1
659
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.