- Local time
- Today, 13:15
- Joined
- Feb 19, 2002
- Messages
- 46,883
It's been 14 years since their addition to Access and up until two days ago, I had been 100% against their use. I was actually present when the MS team announced this "feature" for the first time to about 20 fellow Access experts from around the country and abroad who had been invited to three days of presentations in Redmond. There was almost a revolt when the MS team told us how they were going to implement the feature with a hidden table. There was not a happy person in the room and experts have been steadfastly against the feature from the moment it was announced but only because of the way MS choose to implement it. If they had found a way to do it without hiding the table, we all would have adopted the feature because the interface for it is actually great. But by hiding the table, they prevented the data from being upsized and they prevented us from using it in any case where we had existing data or intersection data.
Anyway, I was helping a poster here with an application. The problem turned out to be, it is really difficult to force a main form record to have at least one choice from one of these multi-value fields when you implement it without the crutch. I was sure I had done this in the past, It is not a frequent requirement but it isn't that rare either. I kept coding myself in knots as I tried to give the user a warning and flag the parent record as incomplete when nothing was selected but not prevent the record from being saved because you have to save the main form record to move into the subform to add a record once you normalize the structure.
After about an hour, I threw up my hands and said - self - you are not getting paid to do this, just give up and just go back to the multi-value field so you can go to bed, so I did. I'm sure I could have gotten it to work but I wasn't prepared to spend any more time on it. One of the problems became making the update visible on the main form when the update was made by the subform. For example, in the AfterUpdate event of the subform, you have to count the subform records and if there are 0 (meaning you've deleted the last one), you have to set the incomplete flag on the parent table to true and if the count is > 0 then you set it to False if it isn't already false. But for some reason, I couldn't make the change visible on the main form. In my defense, it was late and I was tired.
So, if any of you have an example that shows how to flag the mainform as incomplete until at least one subform record has been added, it would be a good addition to our code library. If no one posts a sample in a couple of days, I'll build one myself.
Anyway, I was helping a poster here with an application. The problem turned out to be, it is really difficult to force a main form record to have at least one choice from one of these multi-value fields when you implement it without the crutch. I was sure I had done this in the past, It is not a frequent requirement but it isn't that rare either. I kept coding myself in knots as I tried to give the user a warning and flag the parent record as incomplete when nothing was selected but not prevent the record from being saved because you have to save the main form record to move into the subform to add a record once you normalize the structure.
After about an hour, I threw up my hands and said - self - you are not getting paid to do this, just give up and just go back to the multi-value field so you can go to bed, so I did. I'm sure I could have gotten it to work but I wasn't prepared to spend any more time on it. One of the problems became making the update visible on the main form when the update was made by the subform. For example, in the AfterUpdate event of the subform, you have to count the subform records and if there are 0 (meaning you've deleted the last one), you have to set the incomplete flag on the parent table to true and if the count is > 0 then you set it to False if it isn't already false. But for some reason, I couldn't make the change visible on the main form. In my defense, it was late and I was tired.
So, if any of you have an example that shows how to flag the mainform as incomplete until at least one subform record has been added, it would be a good addition to our code library. If no one posts a sample in a couple of days, I'll build one myself.