Associate two form entries via a number field

Associate two form entries via a number field

Hi

I have two forms, Membership and Payment. Both forms have a Membership ID field and the Membership form contains Payment as a subform.

I want a person to pay their membership entering their Membership ID. On success the Payment form should compare the Membership ID of the entry to Membership IDs in Membership and add the payment record to the correct member in Membership (in the subform).

Basically I need to associate a payment with a member via the ID. ID is just a number field (can't be a lookup as this would display all IDs to people).

Thanks