Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Unmatched Through Code

Status
Not open for further replies.

BenSC

Technical User
Jul 24, 2001
43
GB
Hi All,
I have two tables [tblProject] and [tblLetter] with a one to many relationship between them. When a letter is sent for a project a record is created in [tblLetter], but if a letter has not yet been sent then there is no record in [tblLetter] for the project.
I have a form with combo boxes that are used to filter a report on different critera. In this case I want to filter the report for all projects where a letter hasn't been sent. This would be easy if I could use a simple find unmatched query, but this has to be able to be used in conjunction with other criteria.
This is a sample of the code, which I'm using:

If Me.comboCriteriaContributionLetter.Value = "Not Sent" Then
If Len(strSQL) > 0 Then
strSQL = strSQL & " AND " & "[Criteria]"
Else
strSQL = "[Criteria]"
End If
Else
End If

Any help on this would be much appreciated

Thanks

Ben Cooper
 
Hi Ben!

Try:
If DCount("[Projectno]", "SELECT * from tblLetter WHERE [Projectno] = " & Me!Projectno)=0 Then

This function should return 0 if there is no record in tblLetter for this project.

Hope this helps,
Andy



Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top