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

How to make a writeable cursor (VFP3,VFP5,VFP6)

Usefull Functions & Procedures

How to make a writeable cursor (VFP3,VFP5,VFP6)

by  Mike Gagnon  Posted    (Edited  )
Before the advent of the of to READWRITE with VFP7.0, you could use this procedure to create a writeable based on an SQL statement.
Code:
CLOSE ALL
Select Retail.accno, Retail.name, Detail.address1;
	FROM client!Retail;
	INTO Cursor Query1

MAKEAWRITEABLECURSOR("query1")
GO bottom
APPEND blank
replace accno WITH "2345" && No error message

Procedure makeawriteablecursor
Parameter lccursoralias
Private lnworkarea, lctmpdbfname, lctmpcur, lncurrarea
If Parameter() = 0
	lccursoralias = Alias()
Endif
lncurrarea = Select()
Select (lccursoralias)
lnworkarea = Select(0)
If At(".TMP", Dbf()) > 0
	Select 0
	lctmpdbfname = Dbf(lccursoralias)
	Use (lctmpdbfname) Again
Else
	Select * From (Dbf(lccursoralias));
		INTO Cursor lctmpcur;
		WHERE .T.
	lctmpdbfname = Dbf("lcTmpCur")
Endif
Use (lctmpdbfname) Again In (lnworkarea);
	ALIAS (lccursoralias)
Use
Select (lncurrarea)
Release All Like lnworkarea, lctmpdbfname, lctmpcur, lncurrarea
Return

Mike Gagnon

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top