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!

Check if field is empty before printing

Status
Not open for further replies.

Bird22

Programmer
Jul 18, 2001
8
US
I am trying to check a field to see if there is data present before executing the print code. I am getting "Object variable not set" and "Type mismatch" if there is no data in the field. If the field is populated, everything works OK.
Some of the fixes we have tried won't work if there is data in the field. For example: GetFirstItem property then checking if it is nothing.

Is there any function, item property, etc. that will tell me this?
 
The simplistic way is to just check if field = "".

@if(Field="";@Command(FilePrint);@prompt([OK];"Empty Field";"Please complete Field"))

Assuming you've tried this or for some reason it won't work for you, then consider putting a default value in the field and checking for a change in that default value before printing. If you like that idea, but don't want anything to show in the field then use [alt]32 as your value.
 
Thank you for your quick response. I have tried checking for "" and it didn't work.

I should have said I am trying to check the field value in the printing agent using Lotus Script, not in the form.

Any other suggestions??

 
No, I don't have a field name in a variable. I was checking it like this:

Dim nd as NotesDatabase

IF nd.fieldname(0) = "" THEN
do Process1
ELSE
do Process2

I seem to have figured out a solution. (see below)

Dim nitem as NotesItem

Set nitem = nd.GetFirstItem("fieldname")
IF nitem is Nothing THEN
do Process1
ELSE
do Process2

This seems to work if data is present or if data is not present.

Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top