To start, a better way to write the If statement is
If [IsEmpty ( Table::fieldname1 ) ]
From what I've been able to tell, different types of fields handle your Table::fieldname1="" statement differently. For instance, in a FM file that is populated and has a variety of types of fields, do a Find with "" as the data to find; it will work fine in a text field, but you'll get an error message in a timestamp or date field. The IsEmpty function will work correctly with any type of field.
Thank you for your reply.
and the first field is still being overlooked. Like I said it is picking up field 2. I have checked each field and have the same settings (text) for both fields. I feel like it is going to be a simple box that needs ticking or something but I can't seem to find the box?
Either the reference is to the wrong field (either in your script or on your layout) or the field only looks like it is empty. It might have a space, return or other nonvisible character in it. Click or tab into the field and try double clicking the contents to see if anything invisible highlights. Double check your Table::Fieldnam1 reference and make sure that the "table" part of this refers to the same table occurrence name as the field object on your layout where you are checking to see if this field is empty.