Paradox Community

Items in pnews.paradox-web

Subject:Re: New request
Date:Thu, 18 Aug 2016 08:37:36 -0400
From:"Steven Green" <greens@diamondsg.com>
Newsgroups:pnews.paradox-web
how about a simple "delete" query, to delete all the records that are 
checked?


--

Steven Green
Myrtle Beach, South Carolina, USA

http://www.OasisTradingPost.com

Collectibles and Memorabilia
Vintage Lego Sets and Parts
- and Paradox support, too

"JI"  wrote in message news:57ad05ef$1@pnews.thedbcommunity.com...

I've generated a table from the database.  One of the fields is a
checkbox named 'Delete'.  The following code finds the line in which the
box is checked but I can't get the values of the fields on the line so I
can delete the record.



>     case upper(thebuttonpressed) = "DELETE APPOINTMENT" :
>         jij_lib.getTheUser()
>
>         tcEvents.open(":REPCHKDATA:Events.db")
>
>         for I from 1 to thecount
>             thecheckbox= "c" + string(I)
>
>             try
>                 theCurrentCheckBox = Request.GetField(thecheckbox)
>             onFail
>              Response.resultstring = jij_lib.createAMessage(
"\"Cannot get the checkbox ID. \"")
>              return
>             endtry
>
>             if theCurrentCheckBox = "Delete" then
>                 tcEvents.edit()
>                 theFacilityName = request.getfield("Facility")
>                 theProviderName = request.getfield("Provider")
>                 theAppointmentDate = request.getfield("Date")
>
>                 try
>                     tcEvents.locate(
>                          "ProviderName",theProviderName,
>                          "Name",theUser,
>                          "FacilityName",theFacilityName,
>                          "Event_Next",theAppointmentDate)
>                     tcEvents.deleterecord()
>                 onfail
>                     Response.resultstring = jij_lib.createAMessage(
"\"Cannot find this record. \"")
>                     return
>                 endtry
>
>             endif
>         endfor
>         tcEvents.close()
>         Response.resultstring = jij_lib.createAMessage( "\"You
Deleted a record! Press the REFRESH key. \"")
>         return

         for I from 1 to thecount
             thecheckbox= "c" + string(I)

             try
                 theCurrentCheckBox = Request.GetField(thecheckbox)
             onFail
              Response.resultstring = jij_lib.createAMessage( "\"Cannot
get the checkbox ID. \"")
              return
             endtry

             if theCurrentCheckBox = "Delete" then
                 tcEvents.edit()
                 theFacilityName = request.getfield("Facility")
                 theProviderName = request.getfield("Provider")
                 theAppointmentDate = request.getfield("Date")

                 try
                     tcEvents.locate(
                          "ProviderName",theProviderName,
                          "Name",theUser,
                          "FacilityName",theFacilityName,
                          "Event_Next",theAppointmentDate)
                     tcEvents.deleterecord()
                 onfail
                     Response.resultstring = jij_lib.createAMessage(
"\"Cannot find this record. \"")
                     return
                 endtry

             endif
         endfor
         tcEvents.close()
         Response.resultstring = jij_lib.createAMessage( "\"You Deleted
a record! Press the REFRESH key. \"")
         return 


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


Copyright © 2004 thedbcommunity.com