I run this code:
Expand|Select|Wrap|Line Numbers
- Call DefaultParameter(Me.Name, "ID_Material", ID_Material) 'for write
- x = DefaultParametru(Me.Name, "ID_Material") 'for read
- Public Function DefaultParameter(Form As String, Param As String, Optional ValParam)
- 'Read / Write in table "tblDefault"
- Dim SQL As String, Criteria As String
- If IsMissing(ValParam) Then 'Read
- Criteria = "(Form = """ & Form & """) AND (Parameter = """ & Param & """)"
- DefaultParameter = DLookup("Valoare", "tblDefault", Criteria)
- Else 'Write
- DoCmd.SetWarnings False
- SQL = "UPDATE _Default SET [tblDefault].Valoare = " & ValParam & _
- " WHERE ((([tblDefault].Form)= """ & Form & """)" & _
- " AND (([tblDefault].Parameter)= """ & Param & """));"
- DoCmd.RunSQL SQL
- DoCmd.SetWarnings True
- End If
- End Function
The "WHERE" clause can find ONE or ZERO record(s).
If WHERE will find ZERO records I wish to run an APPEND query, in order to create the record.
So, the question is: Can I "catch" how many records has been updated ?
If I don't use DoCmd.SetWarnings False, Access say how many records will be updated. So, this information is somewhere in his mind.
Please, do not speak about dCount function. I know about that.
Thank you very much !