I have a puzzle!
Main Form is Member_entry and data source is Member details table (has one to many relationship with Angling details table). PERMNO is primary key for member table. It corresponds to APERMNO field in Angling table and V_member in voucher table. i.e they are the same number.
Subform 2 is inside Main form and it’s Data source is standalone Voucher table
SELECT Vouchers.V_number, Vouchers.V_member
FROM Vouchers
WHERE (((Vouchers.V_member)=[Member_details].[PERMNO]));
Only a text box is displayed in subform 2 with the code:
=IIf([Forms]![Member_entry]![PERMNO]=[V_member],"VOUCHER " & [V_number] & " PURCHASED","")
THIS WORKS FINE! It does exactly what it should by displaying a voucher with a record if a voucher exists.
But similar coding in subform 3 doesn’t work
Subform 1 data source is angling details table
Subform 1 is inside Main form
Subform 3 is inside Subform 1
SELECT Vouchers.V_number, Vouchers.V_member
FROM Vouchers
WHERE (((Vouchers.V_member)=[Angling_details]![APERMNO]));
Again, only a textbox is displayed
=IIf([Forms]![Member_entry_subform1]![APERMNO]=[V_member],"VOUCHER " & [V_number] & " PURCHASED","")
The values of APERMNO are always available in subform 1 as the records change. The values of V_member and V_number in subform 3 also change as the records change in the main form and subform 1 but APERMNO just gives #Name?
I don’t actually want the same code, but if I can get that to work, I can alter it to what I need
Can anyone tell me what I’m missing please.