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

Help with refreshing grid

Status
Not open for further replies.

Judi201

Technical User
Jul 2, 2005
315
US
Hi!

I have have used the following to set up grids for selecting an item.

RECORDSOURCE = ""
SELECT someting FROM somewhere INTO CURSOR csrtemp
RECORDSOURCE = "csrtemp"

This works fine if the resulting cursor has few records and they are easily seen in the grid. However, now I need to create a cursor that could have several hundred records.
Soooo, I want to use an incremental search to speed up the find. I used ideas from "1001 Things" and Ramani's FAQ to come up with the following in the 'click' of the UPDATE buttom.
Code:
LOCAL lcjobsnumb, lnCustno, lnOpt
lnCustno = Thisform.txtCustno.Value
lcjobsnumb = csrGrid.jobsnumb
lnOpt = This.Parent.cmgOpt.Value
*** get table update record
SELECT jobs
SET ORDER TO TAG jobsnumb
SEEK lcjobsnumb
IF FOUND()
	lnCurRec = Recno()
	IF INLIST(lnOpt,1,2)
		lnpartstoc = Thisform.txtOpt3.Value
		REPLACE jobs.partstoc WITH lnPartstoc
	ELSE
		lnpartproc = Thisform.txtOpt3.Value
		REPLACE jobs.partproc WITH lnPartproc
	ENDIF
ELSE
	MESSAGEBOX('Job not found', 16, 'Alert')
ENDIF
*** now reset fields and
*** show changes on grid
This.Parent.txtOpt1.Value = 0
This.Parent.txtOpt1.Format = "Z"
This.PArent.txtOpt2.Value = 0
This.Parent.txtOpt2.Format = "Z"
This.Parent.txtOpt3.Value = 0
This.Parent.txtOpt3.Format = "Z"
*** now refresh the cursor
*** and set focus to updated record

SELECT jobs.jobsnumb, jobs.partnumb, jobs.partstoc, jobs.partproc ;
	FROM jobs ;
	WHERE jobs.custno = lnCustno ;
	ORDER BY jobs.jobsnumb ;
	INTO CURSOR csrTemp	NOFILTER

SELECT csrGrid
ZAP
APPEND FROM DBF('csrTemp')
GO lnCurRec
USE IN csrTemp
This.Parent.grdGrid.RecordSource = "csrGrid"
This.Parent.grdGrid.SetFocus()
Thisform.Refresh()

Similiar code in the 'lostfocus' of the txtcustno field creates the csrTemp., then appends to a cursor created on the 'load' of the form with CREATE CURSOR and set the index.

COde similiar to Ramani's FAQ is used in the grid.

OK, this all works fine until I update the table and try to reset the grid showing the changes.

I tried to hold the record number and return to that in the refresh but it returns me to the top no matter what I try.
Also the grid seems to not REALLY get focus. That is, tabs or arrow keys do not move thru the grid as they do the first time around. The only way I can stay on the grid is with the mouse.

I had so hoped to pull this one off myself, but seems I need a push in the right direction.

I know I am stumbling around trying to describe my problem and I apologize.

Any suggestions or comments welcome.

Judi
 
So Sorry,

I am catching the wrong current record!! I bet that will fix most of the problem. Sorry for not finding it before I posted.

Judi

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top