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

SET FILTER TO and APPEND BLANK

Status
Not open for further replies.

SleepDepD

Programmer
Mar 13, 2004
65
0
0
US
There's an implied relationship between my two tables, "People" and "Rides". My form shows "rides" records. I only want my form to show the rides for a given person, so I'm using:
Code:
SET FILTER TO rides.PeopleID=people.PeopleID IN "rides"
On this form new rides can be added--and I'm using APPEND BLANK for this. When my filtered "rides" table doesn't contain any records and I attempt to add one, I'm having some weird problems (like my bound controls disabling). I'm assuming this is because I have a filter set, and I'm adding a new record--which upon addition doesn't satisfy the filter condition. Has any dealt with a similar situation before? If I do a REPLACE on the field that's being filtered so it satisfies the filter condition shouldn't it then be included? Do I have to do some kind of refresh or a SKIP or something?

Appreciate the help.
 
When you do an APPEND BLANK, you're adding a ride but the key value required for the relation is also blank.
Try assigning the value to the record first, then using INSERT INTO instead:
Code:
STORE people.PeopleID TO m.PeopleID
INSERT INTO rides FROM MEMVAR
SELECT rides


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Thanks! That worked out great!

The APPEND BLANK command was actually in a class that someone else on my project wrote, so I just added two properties to the class to make it dynamic: "NewIDField" and "NewID". Then the INSERT statement looks like this:
Code:
&&This code is in a CMD.Click method; the CMD being contained in the CLS
WITH THIS.PARENT
	LOCAL lcCurrentAlias
	lcCurrentAlias=.currentalias

	IF VARTYPE(.newidfield)="C" AND VARTYPE(.newid)="N" ;
			AND LEN(.newidfield)>0 AND .newid>0
		LOCAL lcNewIDField,lnNewID
		lcNewIDField=.newidfield
		lnNewID=.newid

		INSERT INTO &lcCurrentAlias (&lcNewIDField) VALUES (lnNewID)
	ELSE
		APPEND BLANK IN &lcCurrentAlias
	ENDIF
ENDWITH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top