Hi,
I have a combo box on a form with a list of cities in it based on a single field city table. I also have a command button on this form that opens up another form that allows the user to enter in new cities to the city table. Now, after i dd new cities to the table, and when I go back to drop down the city combo box, the new cities I added aren't in the list. I researched tutorials and found that combo boxes need to be requeried in order to reflect the updated table. Here is the line of code that I put in the event procedure for the On Click event of the combo box:
Private Sub cboCity_Click()
Me.cboCity.Requ ery
End Sub
I also tried:
Me!cboCity.Requ ery
but this line of code doesn't work either. I get no code errors, but it doesn't requery.
Now I tried this in the After Update event as well with no luck. The table just doesn't want to requery itself after I've modified the city table. The only way I can get it to reflect the changes is if I close down the form completely and restart it, which is not something I want to do every time I add a new city.
Any suggestions?
Thank you,
Wayne.
12 21443 Rabbit 12,516
Recognized Expert Moderator MVP
Hi,
I have a combo box on a form with a list of cities in it based on a single field city table. I also have a command button on this form that opens up another form that allows the user to enter in new cities to the city table. Now, after i dd new cities to the table, and when I go back to drop down the city combo box, the new cities I added aren't in the list. I researched tutorials and found that combo boxes need to be requeried in order to reflect the updated table. Here is the line of code that I put in the event procedure for the On Click event of the combo box:
Private Sub cboCity_Click()
Me.cboCity.Requ ery
End Sub
I also tried:
Me!cboCity.Requ ery
but this line of code doesn't work either. I get no code errors, but it doesn't requery.
Now I tried this in the After Update event as well with no luck. The table just doesn't want to requery itself after I've modified the city table. The only way I can get it to reflect the changes is if I close down the form completely and restart it, which is not something I want to do every time I add a new city.
Any suggestions?
Thank you,
Wayne.
I've come across this too but I don't know why it won't work. So I usually end up using a Me.Refresh.
MMcCarthy 14,534
Recognized Expert Moderator MVP
In the On Close event of the Add Cities form is when you need to requery the combobox. -
Private Sub Form_Close()
-
-
Forms![FirstFormName]![cboCity].Requery
-
-
End Sub
Mary
Hi Rabbit,
Yeah it is strange. I even tried your Me.Refresh in my code. I put in in my click event on my combo box so when I click to open the combo list options, it should refresh the list immediately. hmmm, what event are you linking your Me.Refresh to?
Wayne.
I've come across this too but I don't know why it won't work. So I usually end up using a Me.Refresh.
Rabbit 12,516
Recognized Expert Moderator MVP
Hi Rabbit,
Yeah it is strange. I even tried your Me.Refresh in my code. I put in in my click event on my combo box so when I click to open the combo list options, it should refresh the list immediately. hmmm, what event are you linking your Me.Refresh to?
Wayne.
I put it right after the code that changes the listbox.
MMcCarthy 14,534
Recognized Expert Moderator MVP
Wayne you are using two different forms so the Me.Refresh won't work as you are refreshing the wrong form. Have you tried the code I gave you in post #3?
Again! Mary, you are two for two with my postings. Your code works perfectly. I should alert Rabbit of this code.
Thank you! :)
Best regards,
Wayne.
In the On Close event of the Add Cities form is when you need to requery the combobox. -
Private Sub Form_Close()
-
-
Forms![FirstFormName]![cboCity].Requery
-
-
End Sub
Mary
MMcCarthy 14,534
Recognized Expert Moderator MVP
I replied to your last message as you made this message, so yes it does work :) And what are you doing up so early in Ireland, get back to bed!
Wayne you are using two different forms so the Me.Refresh won't work as you are refreshing the wrong form. Have you tried the code I gave you in post #3?
Check out Mary's solution, it works great.
Thanks again,
Wayne.
I put it right after the code that changes the listbox.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Scott |
last post by:
I have created a form that has a few combo boxes on it. On the form I
have ComboBoxA which selects data from a region, and ComboBoxB that
selects individual locations within a selected region. I need to
figure out the correct way to Requery ComboBoxA after I have updated
it. I searched the archive for this list and found a simple solution:
put Me.Requery in the AfterUpdate event of ComboBoxA. However, when
I try this I get an error...
|
by: Yves |
last post by:
Hi,
I'm requering a combobox, and attempting to
a) force it to have the first item selected instead of no item
selected
b) use values in hidden columns of the combobox for the selected item
Currently the code looks like this:
'....
|
by: Sean |
last post by:
Greetings all,
I am attempting to make a form that will filter through several tables
that
(I believe) have refretial integrity. I am pulling data from several
tables into the form and i would like to eventually be able to filter
down through the
tables untill i can reach one unique record. I am creating a datbase
to keep track of registered accounts for a stae program. Each
account is registered into the program through a two...
|
by: Tony Dong |
last post by:
Hi there
I have three comboBoxs
I need the first comboBox selected and fill the second comboBox, after
second comboBox selected, it will fill the last comboBox, When I use
selectedIndex change event, it happens before I select second comboBox,
because when I selected first one, it auto fill the second one and make the
selectedindexchanged event happen, how can I disable it untial I select
second comboBox?
how can I do to make this one...
|
by: Matt |
last post by:
Here is my problem. I am trying to get a combo box working that lists all the models of servers that we have. This combo box is just one of many text boxes that I have on my form. I am running a "find" that searches through my database to find the queried server. When it finds it, it lists the information. I want the model number of the server to be displayed in the combo box, and when I click the down arrow on it, I want all of the other server...
| |
by: Miguel |
last post by:
I have an order entry database with two forms. One is for new orders
the other is to update orders. The forms are identical except that one
is strictly order entry. On both forms are three sets of sychronized
combo boxes. When entering test data everything worked perfectly. I
recently migrated 5,000+ records from an Excel file to the database.
The migration was successful and all records were copied over. When I
checked the underlying...
|
by: consonanza |
last post by:
I am working on a report filter form. It has 2 combo boxes
(cmboSelectSubject and cmboSelectCategory) to select criteria.
Selecting an entry in combo 1
restricts the options available in combo 2.
The row source for combo2 is:
SELECT DISTINCT tblComplaintCategory.fldComplaintCategory,
tblComplaintCategory.fldComplaintCategoryID,
tblComplaintSubjects.fldComplaintSubjectID
|
by: zuchowra |
last post by:
Hi everyone. I need help. I have a combo box in my form that i want to populate multiple text boxes after you select your selection in the combo box. Here is my set up.
The Fields that need to be populated are lsited below but must be recorded to a new table. Gets info from Course occurance Table.
Combo Box - Gets Information from Course Occurance Table. This table has all information regarding course information.
Course ID:
Course...
|
by: buddyr |
last post by:
Hello,
I am having trouble with two combo boxes working together.
two tables table1 table2
table1 fields -number and name
table 2 fields -code and number
data in table one field number 1,2,3
data in table one field name Tom, Bob, Jim
data in table two field code 11,22,33,44,55,66,
data in table two field number 1,2,3,1,2,3
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |