VBA refresh current record/control only

I have 2 combo boxes in a sub form (datasheet view).
1.) Category
2.) Question
When a user selects a category, I can get it to filter the question. However, the previous values in the question field disappear. I only want it to filter the current row/record.
Is this possible?
I did attempt doing something like the below, using methods such as re-query and refresh to no avail:
Private Sub Category_AfterUpdate()
Dim recordnum As Integer
recordnum = Me.CurrentRecord
DoCmd.GoToRecord , , acGoTo, (recordnum)
End Sub

Any help would be greatly appreciated.

Kindest regards
melinhomesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
You need to set in the On Enter event the filtered data source and On Exit event reset it to show all.

When a user selects a category, I can get it to filter the question. However, the previous values in the question field disappear. I only want it to filter the current row/record.
So the question is, what are you doing exactly?
0
mbizupCommented:
It sounds like your form is in Continuous Forms View.  Despite *appearing* as though there are separate combo boxes in each record, it is actually only a single control.  When you limit the row source of your combo box, any rows in which the value for that field does not appear in the row source will 'go blank' for that field.

A solution is to overlay a textbox on top of the combo box, bound to the underlying field,  carefully positioned so that the user can sill click the drop down arrow.  With this setup, the textbox will display the stored value regardless of how the drop down list is limited/filtered.

If the underlying field is a numeric ID field, you may need to modify your form's query or use a DLookup in the textbox control source to display the related text.
1
melinhomesAuthor Commented:
Hi mbizup
Its a subform, in datasheet view unfortunately, not continuous forms view. Is the only method to change to form view and overlap?
Thanks
0
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

mbizupCommented:
Yes.  Datasheet View does not offer you that kind of flexibility.

Continuous forms give you a lot more control over what is displayed.

(And in Single Form View, this would not be a problem)
1
Dale FyeOwner, Developing Solutions LLCCommented:
Agree with Miriam.

Here is a sample database I prepared for someone with a similar question not too long ago.
20180317-Continuous_and_Datasheet-.accdb
1
PatHartmanCommented:
I found an old example.  I'm not sure who built it and I haven't used it.  Possibly Roger Carlson.  If anyone knows, please tell me.

I also uploaded the sample I built years ago which uses the field overlay method for continuous forms.
CascadingComboInSubform2k.zip
FixCascadingCombos130128.zip
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeOwner, Developing Solutions LLCCommented:
1
melinhomesAuthor Commented:
Thank you for your help all, it is very much appreciated
0
melinhomesAuthor Commented:
Thank you Pat, Dale and Bizup all comments have been very helpful. Thank you Pat for the sample db, it will help me going forward, great work!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.