Requery combo box on load/open (1 Viewer)

VzqCrs

Member
Local time
Today, 18:21
Joined
Nov 15, 2021
Messages
54
Scenario:
  1. Form A contains:
    1. a combo box to select a requestor
      1. VBA - Form Load: ComboBoxControlName.Requery (I tried this OnActivate too)
      2. VBA - combo box AfterUpdate MyFormControlName.Form.FilterOn = False
    2. Form B (datasheet view)
  2. Form B
    1. Form Load will filter the records on the current user
      1. VBA Form Load: Me.Form.Filter = the current user
Issue:
When Form A is opened the combo box doesn't update, it stays on the last selection that was used.

So if the combo box's last selection was someone other than the current user, Form B doesn't show anything because the filter on the combo box is still active.

What I need is when Form A is opened, the combo box will have no selection and Form B is loaded and filtered on the current user.
I've tried to requery the combo box on open/load/activate and it's not updating. Below is a screenshot of the form, any suggestions?

1642173032004.png
 

Ranman256

Well-known member
Local time
Today, 18:21
Joined
Apr 9, 2015
Messages
4,122
is the combo unbound? an unbound combo will not remember any entries when the form opens.
if bound to a field, then it will.
 

VzqCrs

Member
Local time
Today, 18:21
Joined
Nov 15, 2021
Messages
54
is the combo unbound? an unbound combo will not remember any entries when the form opens.
if bound to a field, then it will.
The combo box is unbound. Is there an alternative?
 

bastanu

AWF VIP
Local time
Today, 15:21
Joined
Apr 13, 2010
Messages
1,210
If the combo is unbound (its Control Source property is empty) and you are not populating it anywhere then when you open the form it will be empty. Are the two forms used as main form\subform or are they independent single forms? You need to show us a screen shot of form A in design view with the combo properties box showing and also the Load event code for both forms. Ideally you should prepare a small db sample with the two forms and just enough "dummy" data in the source table(s) to illustrate the issue.

Cheers,
 

VzqCrs

Member
Local time
Today, 18:21
Joined
Nov 15, 2021
Messages
54
If the combo is unbound (its Control Source property is empty) and you are not populating it anywhere then when you open the form it will be empty. Are the two forms used as main form\subform or are they independent single forms? You need to show us a screen shot of form A in design view with the combo properties box showing and also the Load event code for both forms. Ideally you should prepare a small db sample with the two forms and just enough "dummy" data in the source table(s) to illustrate the issue.

Cheers,
from the main form, click on the second option (Review Active Estimates) or from the forms list, it's frmIncRetEstimates
 

Attachments

  • Estimate Requests (2).zip
    1.6 MB · Views: 250

bastanu

AWF VIP
Local time
Today, 15:21
Joined
Apr 13, 2010
Messages
1,210
Sorry but looks like you used some newer features in your db as I cannot get it to open in my Access 2013 version, I'm sure someone else will help you ...
 

VzqCrs

Member
Local time
Today, 18:21
Joined
Nov 15, 2021
Messages
54
Sorry but looks like you used some newer features in your db as I cannot get it to open in my Access 2013 version, I'm sure someone else will help you ...
what is not allowing you to open it?
 

bastanu

AWF VIP
Local time
Today, 15:21
Joined
Apr 13, 2010
Messages
1,210
Screenshot 2022-01-14 111022.png


Not sure exactly which features in the post 2013 versions of Office cause this but I cannot open the file or import the objects. Maybe try to save it as a previous version first.
Cheers,
 

VzqCrs

Member
Local time
Today, 18:21
Joined
Nov 15, 2021
Messages
54
View attachment 97558

Not sure exactly which features in the post 2013 versions of Office cause this but I cannot open the file or import the objects. Maybe try to save it as a previous version first.
Cheers,
I get an error trying to save it downward because it "requires features used" -

Thank you for your attempt
 

bastanu

AWF VIP
Local time
Today, 15:21
Joined
Apr 13, 2010
Messages
1,210
Maybe just import the two forms in a new file and upload that, don't worry about the tables andor queries, I just wanted to look at the forms anyway.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:21
Joined
Feb 19, 2002
Messages
36,943
There is no reason to requery a combo when a form is opened. Access handles the combos when it opens the form.

If you try out an advanced feature, the db is marked with that info even if you remove the object you were testing with and never actually use the advanced feature. This can make .accdb's not useable by earlier versions of Access.
 

Users who are viewing this thread

Top Bottom