Hi,
i have a continues subform, which is nested into the main form, it shows data without any issue, but when i do changes or add a new record it mess the data inside the related tables
here is my database :
when you open the frmBenefciareies , and go to tab items received it shows the data as expected but when i add new items or modify the current one i get issue
also can we- filter item name according to the item category
regards
how to fix this issue in the subfrm?
-
- BronzeLounger
- Posts: 1227
- Joined: 01 May 2016, 09:58
how to fix this issue in the subfrm?
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78488
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: how to fix this issue in the subfrm?
We'll probably have to change the record source of the subform, but I don't have enough time to go into the details right now. I'll take a closer look later today.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78488
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: how to fix this issue in the subfrm?
The category combo box on the subform should be unbound, and the record source of the subform should contain the ItemName_ID field from tblDist_Items, not from tblItemList.
I added code to set the row source of the item combo box in the After Update event of the category combo box and in the On Current event of the form.
I placed text boxes on top of the category and item combo boxes to display the correct category and item; this is necessary on a continuous form.
I added code to set the row source of the item combo box in the After Update event of the category combo box and in the On Current event of the form.
I placed text boxes on top of the category and item combo boxes to display the correct category and item; this is necessary on a continuous form.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1227
- Joined: 01 May 2016, 09:58
Re: how to fix this issue in the subfrm?
thanks a lot Hans
i just noticed one thing, for the records already there, when you want to choose an item name from the combo box, it shows the last used category filtration
for example in the last record is summarization category, if i straight away wants to change the item name it shows me a list for winterization!
at least i have to re-choose summarization category in order to get a list for it.
another thing can we do something, if i choose the item it automatically gets the category for it and not need for the user to choose it from the combo box
i notice that from tblDist_item , if i choose an item name it will automatically add the category for it.
regards
i just noticed one thing, for the records already there, when you want to choose an item name from the combo box, it shows the last used category filtration
for example in the last record is summarization category, if i straight away wants to change the item name it shows me a list for winterization!
at least i have to re-choose summarization category in order to get a list for it.
another thing can we do something, if i choose the item it automatically gets the category for it and not need for the user to choose it from the combo box
i notice that from tblDist_item , if i choose an item name it will automatically add the category for it.
regards
-
- Administrator
- Posts: 78488
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: how to fix this issue in the subfrm?
Change the On Current event procedure of sbfrDist_Items to
Code: Select all
Private Sub Form_Current()
Me.cboCat = DLookup("ItemCat_ID_FK", "tblItemList", "ItemNameID=" & Nz(Me.cboItemList, 0))
Me.cboItemList.RowSource = "SELECT ItemNameID, ItemName FROM tblItemList WHERE ItemCat_ID_FK=" & Nz(Me.cboCat, 0)
End Sub
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1227
- Joined: 01 May 2016, 09:58
Re: how to fix this issue in the subfrm?
thanks Hans
what about the other suggestion, removing the item Category inside the sub form ? does this will make my life easier?
reards
what about the other suggestion, removing the item Category inside the sub form ? does this will make my life easier?
reards
-
- Administrator
- Posts: 78488
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: how to fix this issue in the subfrm?
Is there no possibility that the same item would be listed in two categories, for example both in summer and winter?
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1227
- Joined: 01 May 2016, 09:58
Re: how to fix this issue in the subfrm?
yes, there is sometimes an item can belong to two or more categories
-
- Administrator
- Posts: 78488
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: how to fix this issue in the subfrm?
We'd have to display both the item and the category in the item combo box, otherwise it wouldn't be clear which item you are selecting. Is that OK?
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1227
- Joined: 01 May 2016, 09:58
Re: how to fix this issue in the subfrm?
if you think this make it better than the separate one will be ok
Regards
Regards
-
- Administrator
- Posts: 78488
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: how to fix this issue in the subfrm?
This simplifies the subform. We need less code. See the attached version.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1227
- Joined: 01 May 2016, 09:58
Re: how to fix this issue in the subfrm?
thanks a lot, that's much better.