Thank you by advance for any help concerning the following:
I wrote a small sub to save in a table ("Sys_GuardVar" containing the fields "Variable": name of the saved variable, and "Value": value of the saved variable) the primary key of the last edited record on a form, when the latter is closed (Primary key: "Referencia_Contrato", which is also the name of the related control in the form) . The sub is called by the form s Unload event and looks like that:
Sub Form_Unload (Cancel AS Integer)
Dim rs As Recordset
If Not IsNull (Me.Referencia_Contrato) then
Set rs = CurrentDb().OpenRecordSet("Sys_GuardVar", dbOpenDynaset)
If Not IsNull (Me.Referencia_Contrato) then
With rs
.FindFirst "[Variable]= 'ReferenciaContratoLast'"
(To check if an existing variable of the same name "Referencia_ContratoLast " has been saved yet)
The compilation fails, saying "Member of method or data not found". It seems that .FindFirst can t apply to rs. It is not even proposed by IDE in fact (when .Find is). I have the same problem a bit further in the sub with trying to apply the method .NoMatch to rs.
The strange thing is that in the corresponding Sub Form_Load()
which reads the values from Sys_GuardVAr, .FindFirst applies perfectly to Me.RecordSetClone...
I would be gratefull for any indication on how to solve this problem.
Alex
I wrote a small sub to save in a table ("Sys_GuardVar" containing the fields "Variable": name of the saved variable, and "Value": value of the saved variable) the primary key of the last edited record on a form, when the latter is closed (Primary key: "Referencia_Contrato", which is also the name of the related control in the form) . The sub is called by the form s Unload event and looks like that:
Sub Form_Unload (Cancel AS Integer)
Dim rs As Recordset
If Not IsNull (Me.Referencia_Contrato) then
Set rs = CurrentDb().OpenRecordSet("Sys_GuardVar", dbOpenDynaset)
If Not IsNull (Me.Referencia_Contrato) then
With rs
.FindFirst "[Variable]= 'ReferenciaContratoLast'"
(To check if an existing variable of the same name "Referencia_ContratoLast " has been saved yet)
The compilation fails, saying "Member of method or data not found". It seems that .FindFirst can t apply to rs. It is not even proposed by IDE in fact (when .Find is). I have the same problem a bit further in the sub with trying to apply the method .NoMatch to rs.
The strange thing is that in the corresponding Sub Form_Load()
which reads the values from Sys_GuardVAr, .FindFirst applies perfectly to Me.RecordSetClone...
I would be gratefull for any indication on how to solve this problem.
Alex