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

Detecting When A New Record Is Added In A Grid (Arrow Down) 1

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
Hello,

I'm automating a grid to automatically assign a unique ID number (1 - 15) to each new household member in my grid. During the form's init event, I capture the next available ID number (gn_NextID) for the first new record added to the household.

I have placed gn_NextID in the table as it's Default Value. I suppose I could change this to (gn_NextID + 1) but my initial question remains -

Can you tell me how (which Event) could I increment a value (in this case gn_NextID) each time a new record (additional household member) is added via the grid?

Thanks,

Dave



The 2nd mouse gets the cheese.
 
Hi In the grids AfterRowColChange event, put the code..

IF myTable.myField = 0
ThisForm.NewId = ThisForm.NewId+1
Replace myNewId WITH ThisForm.NewId
ENDIF

So whever the new record added is empty, the value will be assigned. But are you taking care of the new Id to be removed when the recorded added are just extra, when the down arrow key is pressed so many times.

An alternate way will be, do the NewId checking, only when the records are updated.

:)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Thanks Ramani, this helps. I am validating the records and prompting user to take action before they can exit. The only thing I need to do is deal with someone deleting a pre-existing HH member.

Dave

The 2nd mouse gets the cheese.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top