happybunnyj
Technical User
I have a Form on which I enter info about each Item in my library. I created a subform on which I check a control for each copy of the item (in order to generate a unique ID number for each copy).
I am trying to add a validation check for the subform to make sure that my user checks the box to indicate at least 1 copy before saving the main Item record. I found the following code and added it to as an Before Update on my main form and it works, EXCEPT
1. It will not let me leave the main form to get to the subform (the warning message keeps popping up)
2. This query searches the entire table instead of checking to see if the current item has an associated copy ID.
If DCount("*", "qry-Items without Copy IDs") > 0 Then
MsgBox "The Item has no copies associated with it. Please add at least 1 Copy ID in the sub-form below.", vbOKOnly
Exit Sub
End If
Here's the "qry-Items without Copy IDs"):
SELECT [tbl-ITEMS].ItemID
FROM [tbl-ITEMS]
WHERE ((([tbl-ITEMS].ItemID) Not In (SELECT [tbl-Item Copies Join].ItemID
FROM [tbl-Item Copies Join]));
Thank you in advance for any advice/assistance.
I am trying to add a validation check for the subform to make sure that my user checks the box to indicate at least 1 copy before saving the main Item record. I found the following code and added it to as an Before Update on my main form and it works, EXCEPT
1. It will not let me leave the main form to get to the subform (the warning message keeps popping up)
2. This query searches the entire table instead of checking to see if the current item has an associated copy ID.
If DCount("*", "qry-Items without Copy IDs") > 0 Then
MsgBox "The Item has no copies associated with it. Please add at least 1 Copy ID in the sub-form below.", vbOKOnly
Exit Sub
End If
Here's the "qry-Items without Copy IDs"):
SELECT [tbl-ITEMS].ItemID
FROM [tbl-ITEMS]
WHERE ((([tbl-ITEMS].ItemID) Not In (SELECT [tbl-Item Copies Join].ItemID
FROM [tbl-Item Copies Join]));
Thank you in advance for any advice/assistance.