[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nsbasic-palm
Subject:    Re: [nsbasic-palm] Problems deleting a record
From:       "Dwight Norris" <dwight () ezo ! net>
Date:       2005-05-26 18:45:03
Message-ID: 005401c56223$0a3bdd40$31e7e104 () 0021483099
[Download RAW message or body]

This is my way of deleting a record from a keyed Db
It is backwards from most concepts but you will be able to write the code to
stop the backward concept
I say backward because you have to tap the "DELETE" button then the item in
the list
to delete the listed item

You need this in the Start Up Code Section
Global gvGONE = Integer

this code is in the after code section of the list box

Dim dbKey as String
Dim res as Integer

 'Set global web site name to that selected
  gvName = lstPW.Text(lstPW.Selected)
  gvNewPatient = False

   If gvGONE = 1 Then
      dbKey = LCase(gvName)
      res = Alert("Confirm Deletion","You are deleting" +chr(10) + dbKey +
chr(10) + "are you sure ?",1,"Delete","Cancel")

   'This deletes the selected Web Site
   If res = 0 Then
      res = dbDelete(PassWordDb,dbKey)
      gvGONE= 0
      gvBtnCtrl = 0
      gvNewPatient = True
      NextForm "frmSelectPW"
    ElseIf res = 1 Then
      gvGONE = 0
      gvNewPatient = False
    'This is a test if you cancel delete
    NextForm "frmSelectPW"
    'gvNewPatient = True'test
    Exit Sub

    End If
    End If

  If gvBtnCtrl = 0 Then
    NextForm "frmPWInfo"
  ElseIf gvBtnCtrl = 1 Then
    NextForm  "frmPWInfo"        which form you goto is optiontional
  ElseIf gvBtnCtrl = 3 Then
    NextForm  "frmPWInfo"
  End If

this code is behind the "DELETE" button

gvGONE = 1


----- Original Message -----
From: "jocyetkap" <cskjck@sbcglobal.net>
To: <nsbasic-palm@yahoogroups.com>
Sent: Thursday, May 26, 2005 11:45 AM
Subject: [nsbasic-palm] Problems deleting a record


> Hello,
>
> I am having problems with deleting a record from a database.  It
> seems to "freeze" the database (can't add any more records) or
> doesn't pick the correct record to delete. Basically, there is a
> list box which the user will pick corresponding to the name he wants
> to delete (list box position 1 = database position 1).  Once the
> user picks it from a list, they select the "Delete" button.  Then
> the code comes:
>
>     res=dbOpen(dbName,"NVHcalcs",0)
>     'get value of currently selected
>     a=List1209.Selected
>     res=DbDelete(dbName,a)
>
> Then I try to repopulate the List:
>     temp=DbGetNoRecs(dbName)
>
>     For i=1 to temp
>     Res=DbRead(dbName,i,saveName,...)
>     List1209.add saveName
>     Next
>
> But, sometimes it picks 2 items to delete and it eventhough it has,
> let's say, 5 records, it only shows 3.  It never completely
> populates the list box again.
>
> What am I doing wrong?
>
> Thanks!
>
>
>
>
>
>
>
> Complete Searchable Archive:
>  http://marc.theaimsgroup.com/?l=nsbasic-palm&r=1&w=2
>
> Shortcut URL to this page:
>  http://groups.yahoo.com/group/nsbasic-palm
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>




Complete Searchable Archive:
 http://marc.theaimsgroup.com/?l=nsbasic-palm&r=1&w=2

Shortcut URL to this page:
 http://groups.yahoo.com/group/nsbasic-palm  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/nsbasic-palm/

<*> To unsubscribe from this group, send an email to:
    nsbasic-palm-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic