W
WCDoan
I have used a count subform on another form that works fine. I copied it and
changed the names for the form I was going to use the new count subform in,
but it doesn't work. I have a form that is used to enter an owner. Then, a
command button is clicked to enter animals and their info. You can only have
5 animals. I have a subform that counts and displays the number of animals an
owner has. I was going to add the following so that if more than 5 animals
were attempted to be entered, a message would pop-up saying owner already has
5. When I enter a new owner and try to enter the animals that's when the
error occurs. If I comment out the following If there's no problem, so I'm
assuming it's something to do with the fact that there's no animals on file
for this owner. However, this worked fine when I used this same logic for a
count of complaints. When there was no complaints, it worked fine. Anyone
have any ideas why this doesn't work in this instance?
If Forms![frmOwners]![frmCountOwnersAnimals
subform].Form!CountOfOwnerID_AnimalTbl = 5 Then
MsgBox "Owner Already Has 5 Animals"
Exit Sub
End If
The following If is the one that works and is the one I copied to get the
preceding If statement to use and it works fine. I don't understand why it
works in one spot and doesn't work in the other.
If Forms![frmAnimals]![frmCountComplaints
subform].Form!CountOfAnimalID_ComplaintTbl = 3 Then
MsgBox "You May Only Enter 3 Complaints"
Exit Sub
End If
The error says 'you entered an expression that has no value'. Help!
Thanks,
RandyM
changed the names for the form I was going to use the new count subform in,
but it doesn't work. I have a form that is used to enter an owner. Then, a
command button is clicked to enter animals and their info. You can only have
5 animals. I have a subform that counts and displays the number of animals an
owner has. I was going to add the following so that if more than 5 animals
were attempted to be entered, a message would pop-up saying owner already has
5. When I enter a new owner and try to enter the animals that's when the
error occurs. If I comment out the following If there's no problem, so I'm
assuming it's something to do with the fact that there's no animals on file
for this owner. However, this worked fine when I used this same logic for a
count of complaints. When there was no complaints, it worked fine. Anyone
have any ideas why this doesn't work in this instance?
If Forms![frmOwners]![frmCountOwnersAnimals
subform].Form!CountOfOwnerID_AnimalTbl = 5 Then
MsgBox "Owner Already Has 5 Animals"
Exit Sub
End If
The following If is the one that works and is the one I copied to get the
preceding If statement to use and it works fine. I don't understand why it
works in one spot and doesn't work in the other.
If Forms![frmAnimals]![frmCountComplaints
subform].Form!CountOfAnimalID_ComplaintTbl = 3 Then
MsgBox "You May Only Enter 3 Complaints"
Exit Sub
End If
The error says 'you entered an expression that has no value'. Help!
Thanks,
RandyM