I have been struggling to identify the source of this problem for the past few days. My Internet searches for what's causing this issue have not been fruitful.
This is a program uses Access as the front end UI for user to enter client information into the database hosted on SQL Server.
The interaction should be as follows:
When the main form is initially loaded, the monthly product values filter value is 0 by default. The filter should be updated dynamically when one of the products is selected. It was done under the Form_Current event for the products form.
What I can't figure out is: The filter seems to stuck at the default state. I used the Debug.Print statement to check the latest filter value for the monthly product values form and it shows the correct product ID for the filter. But it's not updated on the UI at all.
What's even weirder is: it works (ie monthly values are listed) sometime when I made changes to the vba code (that sometimes not related to filter) and save it when it's in Application mode eg:
.filter = "prod_id = " & iProdID
to
.filter = "[prod_id] = " & iProdID
But then when I change it to Design mode and start making changes not related to this issue, it stopped working when it's in Application mode again. The behavior is so unpredictable that I am not sure how to proceed. I even remove the form and recreate it again and it's still behaving similarly.
I am using the same way to work on the filer in VBA for the other subforms and they are behaving correctly. Hope to get some feedback on what I overlooked!
Thanks! Kiat
I got it to work now. The original method to assign filter for the product values was to assign the filter value directly to the Product Values form ( Form_ProductVals
) from the Products form's ( Form_Products
) Form_Current
event. That was causing the inconsistency in the results.
Now I changed the code to assign the filter value through the main Clients form (that contains Products and ProductVals subforms). So the code was changed from:
Form_ProductVals.Form.Filter = "prod_id = " & <new ID>
to
Form_Clients.ProductVals.Form.Filter = "prod_id = " & <new ID>
That does the trick. I don't have an explanation of the difference though.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.