Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Resetting focus
Message
 
To
25/09/1998 14:53:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00140552
Message ID:
00140972
Views:
26
I have a form with textboxes and combos to receive data. The user will often enter a new record with several fields requiring identical values of the previous record. I want the user to be able to enter the previous record value in the textboxes or combos if they wish.

Saving the values of the previous record is easy. I assign them to variables in the click of the NewRecord button.

Again, instead of using a public variable here, you should store the data from the previous record in a property. For example, create a property called oLastRecord on your form. Use the SCATTER NAME command to create an object in that property that will store all the fields you want to 'Paste' into the next record:
SCATTER FIELDS Name, Address, City, State, Zip NAME ThisForm.oLastRecord
Now you have all the fields you need in one convenient location; the oLastRecord property of the form. To access them, you could use:
ThisForm.oLastRecord.Name
ThisForm.oLastRecord.Address
ThisForm.oLastRecord.City
etc...
If MyVariable (containing the previous record for a field) is to be chosen by the user how do I get it into the textbox without making a separate button for each? And is it possible to do the same thing with a keystroke?

To accomplish this, create one buttton with a shortcut key defined (this will provide keyboard access to the function). For example, if you have a button on the form with the caption "\<Paste Last Record", the user could either click the button, or press ALT-P to use it.

In the click event of this button, use the GATHER NAME command to 'paste' the values scattered into the oLastRecord object into the current record:
*cmdPasteLastRecord Click Event
Gather Name ThisForm.oLastRecord
kenweber
GCom2 Solutions
Microsoft Certified Professional

Previous
Reply
Map
View

Click here to load this message in the networking platform