Solved Combo list item wont show up immediately in a navigation form (1 Viewer)

Ihk

Member
Local time
Today, 19:23
Joined
Apr 7, 2020
Messages
280
I have navigation form with different tabs.

One of tab is connected to a form “FormA” and this form has a combobox with limit to list items.

This combobox list items are sourced from a table.

But infront of this combox is button to pop up a form “AddTypeForm”, by this user can add more items to combobox list. So basically record will be saved in a table, which appears in combobox list.

Problem:

Record added to combobox wont show up immediately, after closing the popup form. Even I tried to requery that form on close.

It only works, if I move in between tabs on main form and come back to that form containing combobox, then it show the record which I added recently.

It means basically, it works only if form is reloaded.

Let me assume Names.

MainForm (Containing tabs for navigating other forms)

FormA (which has combobox)

AddTypeForm (which pops up to add records to combobox list).

Main form is giving the same name to all subforms under each tab.

I tried

Forms!MainForm!NavigationForm.Requery

This works for date filters etc, but wont bring freshly added combo list item, unless I move around tabs. Note: Database is splitted into front and back end.
 

bob fitz

AWF VIP
Local time
Today, 18:23
Joined
May 23, 2011
Messages
4,717
I would use the "Not on List" event to add data but have you tried something like:
Me.ActiveControl.Requery
in the GotFocus event of the combo
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:23
Joined
Oct 29, 2018
Messages
21,358
I tried

Forms!MainForm!NavigationForm.Requery
What about?

Forms!MainForm.SubformName.Form!ComboboxName.Requery
 

Ihk

Member
Local time
Today, 19:23
Joined
Apr 7, 2020
Messages
280
I would use the "Not on List" event to add data but have you tried something like:
Me.ActiveControl.Requery
in the GotFocus event of the combo
Thank you. I am using "Not on List" event message to ask users to select only from list. (if they write something other than list)
But I want to have form for adding in list, because I want user stamp with time.
I this activecontrol requery on got focus, it also did not help.
 

Ihk

Member
Local time
Today, 19:23
Joined
Apr 7, 2020
Messages
280
What about?

Forms!MainForm.SubformName.Form!ComboboxName.Requery
I tried this way as well, It did not solve. Only if I go to another tab, and come back to that form (tab), then it shows data in list.
And
on the other hand if database is not splitted, then there is no problem , newly added list data immediately appears.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:23
Joined
May 7, 2009
Messages
19,169
can you try on the Close event of "AdTypeForm":

Private Form_Close()
Forms![MainForm]![NavigationSubform].Form!comboName.Requery
End Sub
 

Ihk

Member
Local time
Today, 19:23
Joined
Apr 7, 2020
Messages
280
can you try on the Close event of "AdTypeForm":

Private Form_Close()
Forms![MainForm]![NavigationSubform].Form!comboName.Requery
End Sub
Thank you @arnelgp, but It did not work on close event as well. Text in list did not show up. But I left that tab and came back to that form, text was there in the combolist (as before).
 

bob fitz

AWF VIP
Local time
Today, 18:23
Joined
May 23, 2011
Messages
4,717
Thank you. I am using "Not on List" event message to ask users to select only from list. (if they write something other than list)
I use it to catch when a user is trying to type something that is not in the list but I also add the data from within that event after which I set the Response argument which re-queries the list to include the new entry.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:23
Joined
May 7, 2009
Messages
19,169
ok.
or maybe assign the Recordset of the combo again, on the close event of AdTypeForm:

Private Sub Form_Close()
Dim cbo As ComboBox
Dim rs As DAO.Recordset
Set cbo = Forms![MainForm]![NavigationSubform].Form!comboName
Set rs = CurrentDb.OpenRecordset(cbo.RowSource)
Set cbo.Recordset = rs
End Sub
 
  • Love
Reactions: Ihk

Ihk

Member
Local time
Today, 19:23
Joined
Apr 7, 2020
Messages
280
ok.
or maybe assign the Recordset of the combo again, on the close event of AdTypeForm:

Private Sub Form_Close()
Dim cbo As ComboBox
Dim rs As DAO.Recordset
Set cbo = Forms![MainForm]![NavigationSubform].Form!comboName
Set rs = CurrentDb.OpenRecordset(cbo.RowSource)
Set cbo.Recordset = rs
End Sub
Thank you very much @arnelgp , and everybody else who tried to help me.... Dear @arnelgp this solved my issue perfectly... great love.
 

Users who are viewing this thread

Top Bottom