PDA

Click to See Complete Forum and Search --> : DataCombo on Detail grid of a Master_detail


rezania
Aug 27th, 2000, 12:38 PM
Hi
I have setup a master-detail case. In the detail DataGrid, I have a column of values that represent unit codes (1=Inch, 2=Meter, 3=pound, 4=dozen, ...)
I coded the program so that a DataCombo appears on this cell, and shows the corresponding values from a third table called "Code"
If I change the value of any fields in the DataGrid, and move on to the next row, I get the error message "insufficient key column value..."
In "Codes" table I have gathered all kinds of codes, they are classified by a field named "class".
How can I join a column of DataGrid to "Codes" ? Thanks

Here is my join:

Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=D:\VB6\Systems\MME\MME.mdb;"
Set rsMachGen = New Recordset
strSQL = strSQL & " SHAPE "
strSQL = strSQL & " {"
strSQL = strSQL & " SELECT MachName,MachineNo,MachineCode,MadeInCountry "
strSQL = strSQL & " FROM GeneralDescMachine "
strSQL = strSQL & " ORDER by MachineNo "
strSQL = strSQL & " }"
strSQL = strSQL & " AS ParentCMD"
strSQL = strSQL & " APPEND"
strSQL = strSQL & " ("
strSQL = strSQL & " {"
strSQL = strSQL & " SELECT r.Details,UseCycle,UseAmt,(c.Detail),Operator, "
strSQL = strSQL & " FormDate, UseUnit,MachineNo "
strSQL = strSQL & " FROM RegularServices r "
strSQL = strSQL & " INNER JOIN codes c ON r.UseUnit=c.Code "
strSQL = strSQL & " Where c.Class='UNIT'"
strSQL = strSQL & " }"
strSQL = strSQL & " AS ChildCMD"
strSQL = strSQL & " RELATE MachineNo TO MachineNo"
strSQL = strSQL & " )"
strSQL = strSQL & " AS ChildCMD"
rsMachGen.Open strSQL, db, adOpenDynamic, adLockOptimistic

Set grdServices.DataSource = rsMachGen("ChildCMD").UnderlyingValue