R
Rhys Davies
Hi - i posted a question here yesterday asking how to check if a membership
number already exists in the database on exit from the membership no field,
and the following code works fine:
If Not IsNull(DLookup("membershipno", "tbldramaloan", "[membershipno]='" &
Me!membershipno & "'")) Then
MsgBox "You already have a loan issued to this membership number." & vbCrLf
& _
"Please ensure that you allocate repayments to the relevant loan."
End If
However, the loan information in this table can have multiple membership
number rows (the membership number is not unique), which is fine because
multiple rows means that the individual with that particular membership
number has taken out multiple loans. However that loan table is also linked
to an organisation table, which contains the names of organisations who
provide the loans, and membership number 1034 for example could be present in
more than one organisation. The issue is that i want the dlookup to only
look for duplicate membership numbers within the specific organisation and as
far as i know i cant add additional criteria to a dlookup to allow for this.
for every loan that is created the membership number is entered manually and
a companyID is automatically entered that ties it back to the organisation
that is providing the loan. this is done by having
forms!frmcompany!companyID in the default value of the companyID field on the
loan form. I was wondering if there was a way of using a query/query by form
rather than the loan table to restrict the loans to just the relevant
organisation so the dlookup would then lookup the query but i cant seem to
get that to work either.
Any suggestions?
Thanks,
Rhys.
number already exists in the database on exit from the membership no field,
and the following code works fine:
If Not IsNull(DLookup("membershipno", "tbldramaloan", "[membershipno]='" &
Me!membershipno & "'")) Then
MsgBox "You already have a loan issued to this membership number." & vbCrLf
& _
"Please ensure that you allocate repayments to the relevant loan."
End If
However, the loan information in this table can have multiple membership
number rows (the membership number is not unique), which is fine because
multiple rows means that the individual with that particular membership
number has taken out multiple loans. However that loan table is also linked
to an organisation table, which contains the names of organisations who
provide the loans, and membership number 1034 for example could be present in
more than one organisation. The issue is that i want the dlookup to only
look for duplicate membership numbers within the specific organisation and as
far as i know i cant add additional criteria to a dlookup to allow for this.
for every loan that is created the membership number is entered manually and
a companyID is automatically entered that ties it back to the organisation
that is providing the loan. this is done by having
forms!frmcompany!companyID in the default value of the companyID field on the
loan form. I was wondering if there was a way of using a query/query by form
rather than the loan table to restrict the loans to just the relevant
organisation so the dlookup would then lookup the query but i cant seem to
get that to work either.
Any suggestions?
Thanks,
Rhys.