>>I have a child-parent relationship on one field. WHen displaying the child table in a grid I wanted to have a combo box to allow the user to only select from the values that are available in the parent table...
>>
>
>I don't understand. A combobox in the grid? Is it bound to the foreign key? Can you explain a little more about what you are trying to do?
Thanks for the reply Eric
I have a grid with several fields in it to edit the table. One field is based on another table ie. the value in that field must be from a list of values from the related table. What I wish to do is to display the value from the table I am editing and if I select the column where the data is bound to another table then the list of values from the second table pops up. When a selection is made the data is copied to the current record of the child table. I can get everything to work except copying the data from the parent table to the child table. The code I have so far is:
LOCAL lnColCnt, lnCnt
lnColCnt = This.ColumnCount
lnCnt = 1
FOR lnCnt = 1 to lnColCnt
IF UPPER(This.Columns(lnCnt).ControlSource) = "RODID"
This.Columns(lnCnt).Bound = .F.
This.Columns(lnCnt).AddObject("cboRodId", "COMBOBOX")
This.Columns(lnCnt).CurrentControl = "cboRodId"
This.Columns(lnCnt).cboRodId.Visible = .T.
This.Columns(lnCnt).Sparse = .T.
This.Columns(lnCnt).cboRodId.RowSourceType = 6
This.Columns(lnCnt).cboRodId.RowSource = "Rod.RodId"
This.Columns(lnCnt).cboRodId.FontSize = 8
ENDIF
ENDFOR