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

Grid Refresh Problem

Status
Not open for further replies.

stanmurphy

Technical User
Oct 14, 2000
89
Hello All :)

The code below is in the Click Event of a Delete button on a form that shows appointments in a grid. When I click the Delete button, the grid does not refresh to show that the appointment is deleted. SET DELETED is ON. If I close the form and reopen it, the deleted appointment is gone. The SELECT code is the same as that in the LOAD event of the form and it works fine when the form is loaded initially.

Any ideas??

************************************
SELECT appointments
SET ORDER TO iddatetime

RELEASE m.column1, m.column2, m.column3

STORE ALLTRIM(STR(curAppoint.clientid)) TO m.column1
STORE DTOC(curAppoint.apptdate) TO m.column2
STORE SUBSTR(m.column2,6,2) TO m.submonth
STORE SUBSTR(m.column2,9,2) TO m.subday
STORE SUBSTR(m.column2,1,4) TO m.subyear
STORE curAppoint.appttime TO m.column3

SEEK(ALLTRIM(m.column1)+ALLTRIM(m.subyear);
+ALLTRIM(m.submonth)+ALLTRIM(m.subday)+ALLTRIM(m.column3))

IF FOUND()
IF RLOCK()

DELETE NEXT 1

thisform.grdAppointments.RecordSource = ''

Select x.clientid, x.apptdate, x.appttime, y.counname,;
x.appttype, X.APPTNUM from appointments x;
left join counsellor y on x.counname = y.counname;
where x.clientid=m.clientid;
INTO CURSOR curAppoint ORDER BY x.apptdate

thisform.grdAppointments.RecordSource = 'curAPPOINT'

thisform.grdAppointments.Refresh

thisform.Refresh
ENDIF
ELSE
MESSAGEBOX(m.column1+" "+m.column2+" "+m.column3)
ENDIF

UNLOCK

thisform.Refresh()

RELEASE m.column1, m.column2, m.column3
 
I don't see a TABLEUPDATE() anywhere. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
smurphy

SET DELETED is ON

Also SET DELETED is goes out of scope if your are using a private datasession, if so you should set it in the load of the form. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
smurphy

If you are not using buffering mode, you should try moving the point to update the records.
Records are locked when editing begins and fields are written when the record pointer moves. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
smurphy
sorry I meant moving the pointer.
Like :
skip 1
LOCATE
GO TOP
GO BOTTOM

Any of these.

P.S. I also notice you are refreshing too many times (not that it will solve your current situation), but it strains the system:

thisform.grdAppointments.Refresh && not required since the next line do that also.
thisform.Refresh
ENDIF
ELSE
MESSAGEBOX(m.column1+" "+m.column2+" "+m.column3)
ENDIF

UNLOCK

thisform.Refresh() && You actually only need this.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
I tried selecting the cursor and doing a Go Top before resetting the RecordSource. No effect.
 
Can you use view instead of table? So that you can requery the view and refresh the grid.
 
smurphy

I tried selecting the cursor and doing a Go Top before resetting the RecordSource. No effect.

If you are deleting records from the appointements table, it should be the appointements table that you move the pointer, not the cursor. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
I've never used a view. I'l like to stay with the cursor and make it work.
 
Yes!! mGagnon, that did the trick. Thanks very much :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top