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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am new to Programming...what is wrong with this code? Please help! 1

Status
Not open for further replies.

Margoma

Technical User
Sep 13, 2001
7
US
Hi all,

What I am trying to do: When I enter my Reception number tcursor will search the table if this number already exists...if no...the user can enter a new record. if yes, I want to search the existing record if there are any blank fields. If there are blank fields, I want to tell the user that they have to edit the record to fill in necessary blanks, otherwise a message says that its a duplicate record.
This is my code:

method changeValue(var eventInfo ValueEvent)
var aa string
tc TCursor
endVar
aa=eventInfo.newValue()

if aa <> self.value then
tc.open(&quot;CompSales.db&quot;)

if tc.qLocate(aa) and tc.&quot;Field Name&quot; = blank() then
beep()
msgInfo(&quot;Incomplete Record!&quot;, &quot;Edit Record !&quot;)
else
beep()
msgInfo(&quot;DUPLICATE RECORD!&quot;,&quot;This Record already exists!&quot;)
disableDefault
eventinfo.setErrorCode(CanNotDepart)
endif
endif
endif
endMethod

Any help is greatly appreciated! I am SO frustrated because I cant figure it out!!
Margot
 
If I dunderstand your question correctly, your are testing for two of your three conditions at once you need to
break this: >>if tc.qLocate(aa) and tc.&quot;Field Name&quot; = blank()

into :
if tc.qLocate(aa) then
if isblank(tc.&quot;Field Name&quot;) then
; edit existing rec
else
; alreadyin system
endif
else
; add new rec
endif

HTH,
Richie

 
Ros,

With your help I could finally figure it out! Thank you so much!
Margot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top