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

Look up boxes, Help! 2

Status
Not open for further replies.

bobsa32

Technical User
Jan 19, 2006
168
Hi,

Im fairly new to foxpro, im using V9.0. I have created a little application that stores customer details. i am extended the app to include an equipment register, this register will need to contain the equipment id, description and owner (taken from the customer table). i have created a lookup field to get the customer name, however i dont know how to write the value of the lookup field to the relevant field in the equipment table.

any ideas?
 
Bobsa,
There are many ways to do this. I am assuming you are not using table buffering, as it's a concept you may not be familiar with... are you issuing the command:

TABLEUPDATE() anywhere?

If that is the case, you just need to assign the value to the field. Let's say your value is called:

cLookupName

You can simply issue:

REPLACE EQUIPMENT.CUSTNAME WITH cLookupName

If you are using Table or Row buffering, you then issue
TABLEUPDATE(.T.) to commit the change or
TABLEREVERT() to "Undo" it.

If you do not have table or row buffering set on, then the change is committed to the table the moment you issue the REAPLCE command, so use with extreme caution. If you don't have a grasp on the Optimistic/Pesimistic Table/Row buffering, I suggest spending some time to read the VFP help file on the subject.

Stick with it, you are on a fun and rewarding journey in to the VFP world. If you've made it this far, you're doing well.



Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 

I assume from the heading of your message that you are using a combo box to display the owner names. If so, all you have to do is to set the ControlSource property of the combo box to point to the field in the equipment table that is to hold the name.

For example, if the alias of the equipment table is Equip, and the owner field in Owner, the ControlSource would be Equip.Owner

Also, make sure the combo box's Style property is set to 2, to prevent the user entering spurious values.

I've also assumed that the equipment table contains the actual name, rather than a key that points to the corresponding record in the Customer table. If that's not the case, come back and we can take it further.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks Guys,

Mike I tried your idead first, mainly because im lazy and it looked like the easiest way. It worked a treat, this has been bugging me for ages, ive been trying select statements.

Anyways thanks for replying.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top