Allow Additions to NO

  • Thread starter Thread starter an
  • Start date Start date
A

an

Very strange...

After change Allow Additions to NO - Thanks to AB - the
records with date only between 01 and 12 Feb (all years)
don´t appear in subform...
It's not surprising?
Someone know why not?
Thanks in advance.
an
 
After change Allow Additions to NO - Thanks to AB - the
records with date only between 01 and 12 Feb (all years)
don´t appear in subform...
It's not surprising?
Someone know why not?
Thanks in advance.

I suspect that these are unrelated issues. Could you perhaps post the
SQL view of the subform's recordsource query? It sounds like you might
have inadvertantly converted the Date/Time field to Text (the 01 to 12
sounds like it's looking for months); Access requires that date
literals in a query must be in mm/dd/yyyy format (or an unambiguous
format such as 12-Feb-2004).
 
In order to first time:
Error message Err 3075 (Sintaxe).
I think is in # character, but I don't where...

Private Sub cbxDatas_AfterUpdate()
Dim strSQLSF As String

strSQLSF = " SELECT * FROM T_ValAn "
strSQLSF = strSQLSF & " WHERE T_ValAn.Param = '" &
CbxParam & "' And "
strSQLSF = strSQLSF & " WHERE T_ValAn.IdCompon = " &
CbxIdCompon & " And "
' strSQLSF = strSQLSF & " T_ValAn.Param = '" & CbxParam
& "' And "
strSQLSF = strSQLSF & " T_ValAnuais.Data = #" & Trim
(CbxDatas) & "#"

Me!SubF_HistoricValAn.LinkChildFields = ""
Me!SubF_HistoricValAn.LinkMasterFields = ""

Me!SubF_HistoricValAn.LinkChildFields
= "IdCompon;Param;Date"
Me!SubF_HistoricValAn.LinkMasterFields
= "IdCompon;Param;Dat"
Me.RecordSource = strSQLSF
Me.Requery

End Sub

If is possible I would like your help, please.

Grateful in advance.
an
 
Private Sub cbxDatas_AfterUpdate()
Dim strSQLSF As String

strSQLSF = " SELECT * FROM T_ValAn "
strSQLSF = strSQLSF & " WHERE T_ValAn.Param = '" &
CbxParam & "' And "
strSQLSF = strSQLSF & " WHERE T_ValAn.IdCompon = " &
CbxIdCompon & " And "
' strSQLSF = strSQLSF & " T_ValAn.Param = '" & CbxParam
& "' And "
strSQLSF = strSQLSF & " T_ValAnuais.Data = #" & Trim
(CbxDatas) & "#"

Me!SubF_HistoricValAn.LinkChildFields = ""
Me!SubF_HistoricValAn.LinkMasterFields = ""

Me!SubF_HistoricValAn.LinkChildFields
= "IdCompon;Param;Date"
Me!SubF_HistoricValAn.LinkMasterFields
= "IdCompon;Param;Dat"
Me.RecordSource = strSQLSF
Me.Requery

End Sub

If is possible I would like your help, please.

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] ?
 
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] ?


.
 
Ok, JV.
Problem solved with (Format(cbDatas, "mm-dd-yyyy"))...
Many thanks.
an
-----Original Message-----
Private Sub cbxDatas_AfterUpdate()
Dim strSQLSF As String

strSQLSF = " SELECT * FROM T_ValAn "
strSQLSF = strSQLSF & " WHERE T_ValAn.Param = '" &
CbxParam & "' And "
strSQLSF = strSQLSF & " WHERE T_ValAn.IdCompon = " &
CbxIdCompon & " And "
' strSQLSF = strSQLSF & " T_ValAn.Param = '" & CbxParam
& "' And "
strSQLSF = strSQLSF & " T_ValAnuais.Data = #" & Trim
(CbxDatas) & "#"

Me!SubF_HistoricValAn.LinkChildFields = ""
Me!SubF_HistoricValAn.LinkMasterFields = ""

Me!SubF_HistoricValAn.LinkChildFields
= "IdCompon;Param;Date"
Me!SubF_HistoricValAn.LinkMasterFields
= "IdCompon;Param;Dat"
Me.RecordSource = strSQLSF
Me.Requery

End Sub

If is possible I would like your help, please.

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] ?


.
 
Back
Top