Sorry for my delay.
One litle explanation.
I forgot change that word for you, because:
In portuguese Date(of Calendar) is Data, and
Data (collection of the facts) is Dados (=dice).
Really is <T_ValAnuais.Data> (of calendar).
If necessary, is possible to change Data (calendar) do Dt
(abbreviation).
Next, the code in three Combos: cbxIdCompon to choose
Component. Datatype: Number-Long Integer; cbxParam to
Parameters. Datatype: Text; and cbxDatas (Datas: Plural of
Dt in portuguese). Datatype: Date/Time-Short date.
Like this, is all in original words, Ok?
___
Option Compare Database
Option Explicit
Private Sub cbxIdCompon_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
CbxParam = Null
CbxDatas = Null
strSQL = "SELECT DISTINCT T_ValAnuais.Param FROM
T_ValAnuais "
strSQL = strSQL & " WHERE T_ValAnuais.IdCompon = " &
CbxIdCompon
strSQL = strSQL & " ORDER BY T_ValAnuais.Param;"
CbxParam.RowSource = strSQL
strSQLSF = "SELECT * FROM T_ValAnuais "
strSQLSF = strSQLSF & " WHERE T_ValAnuais.IdCompon
= " & CbxIdCompon
On Error Resume Next
Me!SubF_HistoricoValAnuais.LinkChildFields
= "IdCompon"
Me!SubF_HistoricoValAnuais.LinkMasterFields
= "IdCompon"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
___
Private Sub cbxParam_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
CbxDatas = Null
strSQL = " SELECT DISTINCT T_ValAnuais.Data FROM
T_ValAnuais "
strSQL = strSQL & " WHERE T_ValAnuais.Param = '" &
CbxParam & "' And "
strSQL = strSQL & " T_ValAnuais.IdCompon = " &
CbxIdCompon
strSQL = strSQL & " ORDER BY T_ValAnuais.Data;"
CbxDatas.RowSource = strSQL
strSQLSF = " SELECT * FROM T_ValAnuais "
strSQLSF = strSQLSF & " WHERE T_ValAnuais.Param = '" &
CbxParam & "' And "
strSQLSF = strSQLSF & " T_ValAnuais.IdCompon = " &
CbxIdCompon
Me!SubF_HistoricoValAnuais.LinkChildFields = ""
Me!SubF_HistoricoValAnuais.LinkMasterFields = ""
Me!SubF_HistoricoValAnuais.LinkChildFields
= "IdCompon;Param"
Me!SubF_HistoricoValAnuais.LinkMasterFields
= "IdCompon;Param"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
___
Private Sub cbxDatas_AfterUpdate()
Dim strSQLSF As String
strSQLSF = " SELECT * FROM T_ValAnuais "
strSQLSF = strSQLSF & " WHERE T_ValAnuais.IdCompon = "
& CbxIdCompon & " And "
strSQLSF = strSQLSF & " T_ValAnuais.Param = '" &
CbxParam & "' And "
strSQLSF = strSQLSF & " T_ValAnuais.Data = #" & Trim
(CbxDatas) & "#"
Me!SubF_HistoricoValAnuais.LinkChildFields = ""
Me!SubF_HistoricoValAnuais.LinkMasterFields = ""
Me!SubF_HistoricoValAnuais.LinkChildFields
= "IdCompon;Param;Data"
Me!SubF_HistoricoValAnuais.LinkMasterFields
= "IdCompon;Param;Data"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
___
Private Sub cmdShowAll_Click()
On Error GoTo err_cmdShowAll_Click
CbxIdCompon = Null
CbxParam = Null
CbxDatas = Null
Me!SubF_HistoricoValAnuais.LinkChildFields = ""
Me!SubF_HistoricoValAnuais.LinkMasterFields = ""
Me.RecordSource = "T_ValAnuais"
Me.Requery
exit_cmdShowAll_Click:
Exit Sub
err_cmdShowAll_Click:
MsgBox Err.Description
Resume exit_cmdShowAll_Click
End Sub
___
Private Sub Form_Open(Cancel As Integer)
Dim strSQL As String
strSQL = " SELECT DISTINCT T_ValAnuais.IdCompon FROM
T_ValAnuais ORDER BY T_ValAnuais.IdCompon;"
CbxIdCompon.RowSource = strSQL
End Sub
___
Many thank you for all
an
age-----
.
I would like to try to help, but since you do not provide any
information about the values of cbxParam, cbxIdCompon, or cbxDatas I
really have no idea. Please try running this code step by step in
debug mode, and post the value of strSQLSF, and indicate the datatype
(number, text, or date/time) of each of the fields.
Note that the word DATE is a reserved word, and is dangerous to use as
a fieldname. Try using [Date] in the LinkChildFields. Is
T_ValAnuais.Data perhaps intended to be T_ValAnuais. [Date] ?
.