Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check for a field with no data?
Message
From
27/07/2003 18:42:42
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
 
To
27/07/2003 15:16:16
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00813927
Message ID:
00813955
Views:
7
This message has been marked as a message which has helped to the initial question of the thread.
Hi Henry,

"...any one one of the 3 fields in a table has data. If it does then, disable the enter Data button to allow Edits only..."

If I understand your goal, your code will not run correctly. Say mPersonalData is not empty and you disable cmdEnterData. Then you go to the next IF statement and mPastHist is empty. Here you enable cmdEnterData, but you really should leave it disabled since mPersonalData was not empty.

Here's code that is more concise and will enable the cmdEnterData button only when all three fields are empty.
THISFORM.cmdEnterData.Enabled = ;
	EMPTY(curPatientSummary.PersonData) AND ;
	EMPTY(curPatientSummary.PastHist) AND ;
	EMPTY(curPatientSummary.Allergies)

Finally, set your mUpdatePatSummary:
mUpdatePatSummary = NOT THISFORM.cmdEnterData.Enabled
>Hi all:
>
>Here is the code I have been working with:
>
>
   mPersonalData = CurPatientSummary.PersonData
>	mPastHist = CurPatientSummary.PastHist
>	mAllergies = CurPatientSummary.Allergies
>        IF !empty(mPersonalData)
>		mUpdatePatSummary = .t.
>		thisform.cmdEnterData.Enabled = .f.
>	ELSE
>		thisform.cmdEnterData.Enabled = .t.
>	ENDIF
>
>	IF !empty(mPastHist)
>		mUpdatePatSummary = .t.
>		thisform.cmdEnterData.Enabled = .f.
>	ELSE
>		thisform.cmdEnterData.Enabled = .t.
>	ENDIF
>
>	IF !empty(mAllergies)
>		mUpdatePatSummary = .t.
>		thisform.cmdEnterData.Enabled = .f.
>	ELSE
>		thisform.cmdEnterData.Enabled = .t.
>	ENDIF
>
>I have tried this with NOT ISNULL() adn NOT ISBLANK() functions, but does not seem to work, in that the first time a blank field is encountered it works, but the second time around for a new record, the behaviour is not as what is expected.
>
>All I am trying to do here is to see if anyone one of the 3 fields in a table has data. If it does, then, disbale the enter Data button to allow Edits only. If it does not have any data, then enable Enterdata only and disable Edit. There could be situation where only one of the fields is blank - in which case it should be treated as an edit.
>
>Where am I going wrong? Thanks in advance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform