Yes, the query is the record source for a form. I have included a partial sql statement (1/4 of it!) below - this should give you the general idea....
As you can see, expressions such as [forms].[frmMailLogSearch].[framesearchchoice] recur frequently, and if I could replace [forms].[frmMailLogSearch].[framesearchchoice] etc. with say, xxx it would shorten the SQL considerably. ( I did want to attch a screen shot of the Access DESIGN view as this is more understandable, but I can't see how to attach it. Any ideas?)
SELECT tblMailLog.*, tblMailLog.PassedToLHBMember, tblMailLog.FromOrganisation, [forms].[frmMailLogSearch].[framesearchchoice] AS s, [forms].[frmMailLogSearch].[cboPassedToLHBMember] AS x, tblMailLog.MailItemIDNo, *
FROM tblMailLog
WHERE (((tblMailLog.PassedToLHBMember)=[Forms]![frmMailLogSEARCH]![cboPassedToLHBMember]) AND ((tblMailLog.FromOrganisation) Not Like "" And (tblMailLog.FromOrganisation) Is Not Null) AND (([forms].[frmMailLogSearch].[framesearchchoice])=2 Or ([forms].[frmMailLogSearch].[framesearchchoice]) Is Null Or ([forms].[frmMailLogSearch].[framesearchchoice])=0) AND ((tblMailLog.MailItemIDNo)=[forms].[frmMailLogSearch].[Text80]) AND (([Forms]![frmMailLogSEARCH]![FrameFilterIncomplete])=1) AND ((tblMailLog.ActionOrInfo)="A") AND ((tblMailLog.ActionComplete)="N")) OR (((tblMailLog.PassedToLHBMember)=[Forms]![frmMailLogSEARCH]![cboPassedToLHBMember]) AND ((tblMailLog.FromOrganisation) Like [Forms]![frmMailLogSEARCH]![cboFromOrganisation]) AND (([forms].[frmMailLogSearch].[framesearchchoice])=2 Or ([forms].[frmMailLogSearch].[framesearchchoice]) Is Null Or ([forms].[frmMailLogSearch].[framesearchchoice])=0) AND ((tblMailLog.MailItemIDNo)=[forms].[frmMailLogSearch].[Text80]) AND (([Forms]![frmMailLogSEARCH]![FrameFilterIncomplete])=1) AND ((tblMailLog.ActionOrInfo)="A") AND ((tblMailLog.ActionComplete)="N")) OR (((tblMailLog.FromOrganisation) Like [Forms]![frmMailLogSEARCH]![cboFromOrganisation]) AND (([forms].[frmMailLogSearch].[framesearchchoice])=1) AND ((tblMailLog.MailItemIDNo)=[forms].[frmMailLogSearch].[Text80]) AND (([Forms]![frmMailLogSEARCH]![FrameFilterIncomplete])=1) AND ((tblMailLog.ActionOrInfo)="A") AND ((tblMailLog.ActionComplete)="N")) OR (((tblMailLog.FromOrganisation) Like [Forms]![frmMailLogSEARCH]![cboFromOrganisation]) AND (([forms].[frmMailLogSearch].[framesearchchoice])=1) AND ((tblMailLog.MailItemIDNo)=[forms].[frmMailLogSearch].[Text80]) AND (([Forms]![frmMailLogSEARCH]![FrameFilterIncomplete])=1) AND ((tblMailLog.ActionOrInfo)="A") AND ((tblMailLog.ActionComplete) Is Null Or (tblMailLog.ActionComplete) Like "")) OR (((tblMailLog.FromOrganisation) Like [Forms]![frmMailLogSEARCH]![cboFromOrganisation]) AND (([forms].[frmMailLogSearch].[framesearchchoice])=1) AND ((tblMailLog.MailItemIDNo)=[forms].[frmMailLogSearch].[Text80]) AND (([Forms]![frmMailLogSEARCH]![FrameFilterIncomplete])=2) AND ((tblMailLog.ActionOrInfo) Like "*" Or (tblMailLog.ActionOrInfo) Is Null) AND ((tblMailLog.ActionComplete) Like "*" Or (tblMailLog.ActionComplete) Is Null Or (tblMailLog.ActionComplete) Like "")) OR ((([forms].[frmMailLogSearch].[cboPassedToLHBMember]) Like "Select LHB Member here"));
Thanks for helping.