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

Opening a form with a selected record from a grid 1

Status
Not open for further replies.

kstart

Programmer
Dec 25, 2004
21
US
This is a problem re-visited I have a better understanding but still am struggling with this issue.

I have two forms, the first is a data entry form named "Contacts." The second named "Change" is a form with a grid that shows all the contacts which is read only. I am trying to select a name in the grid and open the "contact" form with that record for editing or viewing purposes.

Following the example given in VFP9 help on "Passing Parameters to a form."

I made a new property named "firstname" for the "change" form.

The value of the property "firstname I left at .F. since I don't know what it means.

In the "change" form's Init event I put

[lPARAMETERS cString]
[THIS.firstname=cString]

In the double click event for the grid Text1 "which reflects the first name of the contact"

I placed [DO FORM change WITH THIS.Value]

The error shows that "No PARAMETER statement is found"
I obviously am missing some small detail,the idea, or some code as I do not know where the parameter statement is. I followed the VFP help example exactly I thought. ANy help would be appreciated.
 
Tamar,

It was my understanding that Kstart was using the Default data session and not getting it to work, thus the other approach. I remember how hard it was for me to get Default to work at first and using Private seemed to give me more control until I understood a little better.

Kstart, I did not mean to mislead. That approach worked for me but I'm sure you know that Tamar 'wrote the book'!!! I am still trying to learn and learning a lot from her book (books).[smile]

Judi
 
What I'm recommending for KStart is to share the data session between the two forms. If the first form has a private data session and calls a second form set for default data session, the second form uses the first form's data session.

"Default data session" doesn't always mean data session 1, the one you see in the Command Window. Unfortunately, this is just bad terminology from Microsoft.

Tamar
 
Tamar,
Yes, I understand that now, but struggled at first and when I made both private and used SEEK() to match records I could get it to work so I thought maybe... But I am sure it is better to do it the right way as you have explained. I didn't mean to muddy the waters.

Maybe no one else follows my convulated path to understanding.
[smile] Sometimes the obvious is the hardest for me.

Judi
 
Judi you did not mislead me, I learned alot.

Tamar it worked exactly as I wanted. Just by properly setting the data sessions.

Thanks everyone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top