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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Eliminating detail records based on a memo fields' contents

Status
Not open for further replies.

RacerGirl117

Technical User
Sep 25, 2002
234
US
I have a report that contains a memo field. Some of the records in the report need to be eliminated based on whether or not the field contains the word "transfer". The word could be located anywhere in the field. I've attempted to do this via the query, but it's not working correctly (eliminating records it shouldn't). I'd like to do this in code, but I don't even know if it's possible.

So my question is... is it possible to eliminate records based on contents in a memo field? If so, how would I do that with VBA?

I've tried

If Comments = "*transfer*" Then
Detail.Visible = False
Else
Detail.Visible = True
End If

but I get an error message sayint it can't find the field Comments.

Thanks in advance, Jessica Morgan
Fire Fighter Sales & Service Co.
Pittsburgh, PA
 
Hi Jessica,
Is this field "Comments" coming from the recordsource of the report? You can find out by clicking on View, then click on Field List. If it is something that you placed on the report, then the name is different than what you are currently using (which is "Comments"). You can find the real name of the control by clicking on it, then going to Properties (under View), click on the Other tab to see the Name property.
Instead of using the equal sign, try using the word "like". So, your code will look like this (presuming the memo field is called txtMemo):
if txtMemo Like "*transfer*" then
etc., etc.
End if
HTH,
Randy Smith
California Teachers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top