Subject Can't add to joined query
Author dr_bentonquest <correoschafa@hotmail.com>
Hi there,

I have this TIBOQuery with a joined SQL command. It joins the
PAQUETES (packages) and ARTICULOS (items) tables. KeyRelation is set
to PAQUETES, this is the table I want to add records into. Primary
Key of this table is composed of two fields, PAQUETE (package code)
and CVEART (item code).

Problem is, I call the Append method and the query enters Insert
state, but a dbEdit control bounded to the CVEART TField (item code)
behaves like a ReadOnly control, i.e., I can't type anything in
there. TField is not ReadOnly, please see below. What am I doing
wrong?

Thanks in advance,

-Jorge
------

object quPaquetes: TIBOQuery
Params = <
item
DataType = ftUnknown
Name = 'pPaq'
ParamType = ptUnknown
end>
DatabaseName = 'SERVERISC:/opt/casanova/invpro.gdb'
DeleteSQL.Strings = (
'DELETE FROM PAQUETES'
'WHERE'
' CVEART = :OLD_CVEART AND'
' PAQUETE = :OLD_PAQUETE')
EditSQL.Strings = (
'UPDATE PAQUETES SET'
' CVEART = :CVEART,'
' CANTID = :CANTID'
'WHERE'
' CVEART = :OLD_CVEART AND'
' PAQUETE = :OLD_PAQUETE')
IB_Connection = dm.dbInvpro
IB_Transaction = dm.trInvpro
InsertSQL.Strings = (
'INSERT INTO PAQUETES('
' CVEART, /*PK*/'
' PAQUETE, /*PK*/'
' CANTID)'
'VALUES ('
' :CVEART,'
' :PAQUETE,'
' :CANTID)')
RecordCountAccurate = False
OnNewRecord = quPaquetesNewRecord
KeyRelation = 'PAQUETES'
SQL.Strings = (
'select A.PAQUETE,A.CVEART,A.CANTID,B.DESCRIP,'
'A.CANTID*B.ULTCOST as IMPORTE'
'from PAQUETES A'
'join ARTICULOS B on (B.CVEART=A.CVEART)'
'where A.PAQUETE=:pPaq'
'order by A.CVEART')
FieldOptions = []
Left = 380
Top = 34
object quPaquetesPAQUETE: TStringField
FieldName = 'PAQUETE'
ReadOnly = True
Required = True
Size = 12
end
object quPaquetesCVEART: TStringField
FieldName = 'CVEART'
Required = True
Size = 12
end
object quPaquetesDESCRIP: TStringField
FieldName = 'DESCRIP'
ReadOnly = True
Required = True
Size = 45
end
object quPaquetesCANTID: TIBOFloatField
FieldName = 'CANTID'
end
object quPaquetesIMPORTE: TIBOFloatField
FieldName = 'IMPORTE'
ReadOnly = True
currency = True
end
end
object dsPaquetes: TDataSource
DataSet = quPaquetes
OnStateChange = dsPaquetesStateChange
Left = 424
Top = 34
end
end