drop down refresh (1 Viewer)

mikematthys

New member
Local time
Today, 11:53
Joined
Jan 24, 2019
Messages
7
Hi,

I have a main page, on that main page there is a field called 'sel_naam_dropdown'
the data in that field comes from a subform when you click on the line in the subform it gets the naam of the person in that line '=[Form]![Sub1].[Form]![Naam]'
works perfectly

on that subform i have a dropdown
the dropdown gets his data from a query
SELECT Plan_namen.naam, Plan_namen.inslag2 AS sel FROM Plan_namen
WHERE (((Plan_namen.inslag)=True)) AND (((Plan_namen.naam)=[Formulieren]![planrooster]![sel_naam_dropdown]));
UNION SELECT Plan_namen.naam, Plan_namen.aanvullen2 AS sel FROM Plan_namen
WHERE (((Plan_namen.aanvullen)=True)) AND (((Plan_namen.naam)=[Formulieren]![planrooster]![sel_naam_dropdown]));
the query is way longer then this but you get the point, this way i can specify what the dropdown shows for a specified person.

this works but
my problem that i have now is the refresh
if i use F5 before clicking on the dropdown it works as intended, but ofc we dont want to click F5, is there anyone that can tell me how to do a refresh for this to work

i tried close/open, requery ... nothing seems to work
 

Ranman256

Well-known member
Local time
Today, 14:53
Joined
Apr 9, 2015
Messages
4,339
either:
click the REFRESH button on the toolbar (exhausting)
or
put a requery in the afterupdate event

Code:
sub cboBox_aftupdate()
  me.subformName.form.requery
end sub
 

bastanu

AWF VIP
Local time
Today, 11:53
Joined
Apr 13, 2010
Messages
1,402
In the dropdown (combo box) OnEnter event add the line:

me.cboYourDropdownControlName.Requery

Cheers,
Vlad
 

Frothingslosh

Premier Pale Stale Ale
Local time
Today, 14:53
Joined
Oct 17, 2012
Messages
3,276
Yep, you can use the Requery method on a combobox to requery the control without having to requery the entire form.

Vlad's answer is the one you want to use: Me.ComboBoxControlName.Requery
 

Users who are viewing this thread

Top Bottom