melinhomes
asked on
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
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
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.
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.
ASKER
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
Its a subform, in datasheet view unfortunately, not continuous forms view. Is the only method to change to form view and overlap?
Thanks
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
here is the thread I referred to in my previous post.
ASKER
Thank you for your help all, it is very much appreciated
ASKER
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!
So the question is, what are you doing exactly?