>oFrm.Edit1.Value = filetostr('m.txt') && original memofield is copied to m.txt >>pass through an editbox to add to the memofield and now i am trying to compare the original memofield with the editbox info
>if not empty oFrm.Edit1.Value &&& is editbox empty >wait window 'empty this works' >endif > >if oFrm.Edit1.Value # filetostr('m.txt') &&&& 'original memo field empty and editbox has data >wait window 'this does not work SITUATION IS NOT DETECTED' >endif > >if filetostr('m.txt') = " " original memofield empty >wait window 'this does not work SITUATION IS NOT DETECTED' >endif >>any help with correct effective code for these two situations much appreciated.
oFrm.Edit1.Value = SomeTable.SomeMemoField * Editbox contents may get changed here IF oFrm.Edit1.Value == SomeTable.SomeMemoField etc. * Note the use of the double equal signs == which means the comparison must be exact. It's a good idea to get in the habit of using it for almost all string comparisons. * If you've bound the editbox to the table memo field so the latter gets automatically updated, * you can save the initial value of the memo field to a memory variable: lcOldMemoFieldValue = SomeTable.SomeMemoField oFrm.Edit1.Value = SomeTable.SomeMemoField IF oFrm.Edit1.Value == lcOldMemoFieldValue etc.2. EMPTY( ) is a function e.g.
IF EMPTY( oFrm.Edit1.Value ) etc.3. If you want "original memo field empty and editbox has data" then you either have to include both conditions in one line, or nest them:
* One line: IF EMPTY( SomeTable.SomeMemoField ) AND NOT EMPTY( oFrm.Edit1.Value ) etc. * Nested IFs: IF EMPTY( SomeTable.SomeMemoField ) && original value empty IF NOT EMPTY( oFrm.Edit1.Value ) && current editbox value not empty * code here meets both conditions ENDIF ENDIF4. In character comparisons the empty string "" is not the same as one space " ".
* Your code uses a single = (inexact string comparison) against a single space character if filetostr('m.txt') = " " * You could use exact string comparison to the empty string: IF FILETOSTR( 'm.txt' ) == "" * but better is a nested function call: IF EMPTY( FILETOSTR( 'm.txt' ) )