Link to home
Create AccountLog in
Avatar of UbiqutyDegins
UbiqutyDegins

asked on

Access 2010 Form filtering question

I have a form that have a combobox that chooses what record to display on the form.  When I load the form, before selecting anything in the combobox, the Text boxes on my form are populated with the first record in the corresponding table.  How do I get the form to just be blank when it loads?
Avatar of AccessGuy1763
AccessGuy1763

The best way to do this would probably be to have all of your fields on the form Unbound on load.  You could add code like this to the After_Update event of your combobox to "turn them on":

me.ControlName1.ControlSource = "FieldName1"
me.ControlName2.ControlSource = "FieldName2"

You might need to Requery the form after you've set the ControlSource properties for your fields to get everything to actually show up:

me.Requery

Hope this helps!
Avatar of UbiqutyDegins

ASKER

The combo box has an embedded Macro associted with it that finds the records.  If I set an Ater_Update event will that remove the macro?
Nice catch!

Use "SetProperty" if you're using a macro... one line for each control.

There's also a "Requery" macro if you need to use.
There does not seem to be a choice for the control source when using SetProperty.User generated image
ASKER CERTIFIED SOLUTION
Avatar of AccessGuy1763
AccessGuy1763

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
I do not see SetValue as an Option
Click "Show All Actions" up on the toolbar.  Newer versions of Access don't show "unsafe" actions by default.

User generated image
Thank you for your help and patience.