Editing data on a filtered form (Focus problem)

Hank.School

Registered User.
Local time
Today, 14:33
Joined
Oct 14, 2016
Messages
39
Hi guys,

I have a subform that is filtered by a combobox on my main form. The subform filter is set and enabled in the AfterUpdate event of the ComboBox as described here:
https://access-programmers.co.uk/forums/showthread.php?t=172503

Works fine.

The problem is that after the filter is applied, I cannot edit data. When I go to the data I want to edit, the focus always goes back to the first record. I have read that the first record is selected each time a filter is applied but it should only applied by the Combobox AfterUpdate... I don't see why the focus would continue to change.

Anyone know how to stop it from changing so I can edit?

Thanks
Hank
 
Hi Hank. It might help understand what's happening with your db if you could show us exactly how you implemented the filtering code in the AfterUpdate event of your Combobox.
 
Thanks for replying...


It is exactly as described in Post #2 (which you contributed to :)) of the thread I linked.


In the AfterUpdate event of my Combobox, I have:


Code:
[Forms]![FRM_JobTracking]![FRM_JobSiteList].Form.Filter = "[SubPart] = " & Me.cboSubPart
[Forms]![FRM_JobTracking]![FRM_JobSiteList].Form.FilterOn = True
It works fine to filter but focus is constantly updating. I even set a breakpoint on the code but it only runs after updating the combobox (just as I would expect).


The combobox lets the user select a SubPart of a job that has multiple parts. The job list (subform) gets filtered based on the subpart chosen in the combobox. That works but I need to be able to edit those filtered records.



Thanks
Hank
 
Is there by chance a timer event running?
 
No timers that I have set, no. If I clear the filter (a command button next to the combobox clears the filter) the focus is fine. I will try to duplicate it in a new DB and see what happens.
 
No timers that I have set, no. If I clear the filter (a command button next to the combobox clears the filter) the focus is fine. I will try to duplicate it in a new DB and see what happens.
And if you can't figure it out, maybe you can post a sample db demonstrating the problem, so we can look around it.
 
The only other thing I can think of that could be a factor is that the subform is Linked to the Master by a value in a different combobox (It selects the job). That link is set up manually through an intermediate textbox (since the main form is unbound). The AfterUpdate event of that combobox requeries the subform. I set a breakpoint there also but it is not doing anything unusual.
 
Ok, I think I fixed it.. it is a little obscure so I don't think it will help others but I will post the issue anyway.

My main form selects a job with a combobox (cboJobs) that has its source as the Jobs Table. The jobs table has 4 columns of data but the properties of the combobox only display the name.

As I mentioned previously, I have a textbox that I use to Master/Child link the job information subform to my main form. That textbox got populated with the jobid selected in the cboJobs combobox by setting the text box's Record Source property to '=Me.cboJobs.Column(0)'. Pretty standard stuff and it works fine.

Apparently that method was somehow causing my problem. I cleared the Record Source property of the textbox and I am instead setting it in the After Update event of the cboJobs combobox with 'Me.txtJobLink = cboJobs.Column(0)'

Setting the value of the textbox by its Record Source property must have been constantly polling the cboJobs combobox and causing a problem with the focus. Luckily, there is almost always multiple ways to do things! Anyway, I appreciate all the people who took the time to respond... this is really a great forum. Thank you all :)
 
Hi Hank. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom