Print of certain text when when conditions is correct

rajput

Registered User.
Local time
Today, 13:55
Joined
Jan 11, 2001
Messages
39
Hi,
I have made a samll database using MSaccess 2000 that prints stickers. User enters info on a form and pushes the print button and preview report of that record is inisiated directly to the printer. Now I want to print a text when the "type" field Contains letter "T" and the date of expiration field has a date between one year and 10 years from today's date if it is true it will print the text if not it will not print that text.
However I don't want that text to be saved for each record becuase it will make my database big. Any suggestions.

Thank you
Rajput


[This message has been edited by rajput (edited 04-11-2001).]
 
Hi Rajput. Create a text control with the following as the source and you should be good to go.
  • =IIf(InStr(1,[type],"T")>0 And [DateField] Between DateAdd("yyyy",-10,Date()) And Date(),"Some text","")

Good luck.
~Abby
 
Thanks Abby for your quick response. I did get it to work but am having some trouble with the dates. see here what I am doing.

I have these concerned fields

1)Type
2)StickerDateOfIssue
3)StickerExpiryDate

Now I only want that text("Some Text") to appear when the expiry date is one year from today or 5 years from today and have a T or B type but not on six months from today. I have put in your code and changed the -10 to +5 it works good but the text is also appearing in six months from now. I only want it to apper when it is 1 year from today that is if the case is
Type is B or T
Date of issue is 11 Apr. 2001
Date of Expiry is 10 Apr. 2002 or 10 Apr. 2006 or anything between these years that is 2003, 2004, 2005.
The text should print.

but if it is
Type is B or T
Date of Issue is 11 Apr. 2001
Date of Expiry is 10 Oct. 2002 or up to 09 Apr. 2002 So any date between 11 Apr. 2001 and 09 Apr. 2002 is there ofcourse it will be less then one year and the text will not appear.

I hope I am making some sense of it.

Thanks again for reading and taking the time to help me.

Rajput
 
Hi Rajput. Glad to be of service. I'm not sure I fully understand your criteria. But, I think this source might be it:
  • =IIf([Type] In ("B","T") And [StickerExpiryDate] Between DateAdd("yyyy",1,DateAdd("d",-1,[StickerDateOfIssue])) And DateAdd("yyyy",5,DateAdd("d",-1,[StickerDateOfIssue])),"Some text","")

It produces the results shown in your examples as I understand them. If it's not quite right let me know. I hope this helps.

~Abby
 
Hi Abby,
Thanks allot that source worked great.

Thank allot for your help.

Rajput
 

Users who are viewing this thread

Back
Top Bottom