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

populating field

Status
Not open for further replies.

primerov

Technical User
Aug 16, 2002
160
BG
Populating a field in a table depending on another


In my table customers i want to populate the field segmenid depending on the
choice in the lookup field Typeid. Both fields, typeid and segmentid are placed in the

table Customers. The field Typeid is a lookup field, looking in the table Type.
If i choose Typeid 1,2,3,4, or 5, then i want to populate the field Segmentid as follows:

segmentid = 1. In all the other cases the filed should be populated as SegmentID = 2
How can i do it?
 
Hi!

I'm not sure if and how you might do this directly on a table. In a form, however, it's possible thru using events. So if you're going to populate your TypeID field thru a form, this approach might suit you:

BTW - using this approach, name the controls (on the form) representing typeid and segmentid so that the names of the controls on the form differs from the field names in the tables (cboTypeID, txtSegmentID)

In the cboTypeID combos after uptdate event, you might put the following code:

[tt]if me!cboTypeID <= 5 then
me!txtSegmentID = 1
else
me!txtSetmentID = 2
end if[/tt]

HTH Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top