Recordset won't update with additional field ?

liamfitz

Registered User.
Local time
Today, 19:04
Joined
May 17, 2012
Messages
240
The following is a sub-routine, which ran perfectly well, before I added ( both to the underlying table/query and the .Edit & .Update in the Sub) the field ... !Signpost_ID. i've run teh debug through it,a nd it just skips out of teh procedure, at the point it recahes the line !Signpost_ID = Me.cboSignposts.Value ?? Any helpful suggestions, would be appreciated. I've checked the 'usual suspects' i.e. Syntax, spelling, is field in recordset ? Unfortunately, I get no error message such as, " Item not in this collection " for example.

Code:
Sub UpdRefInfo()
    With Forms!frmClients!sfrmReferrals.Form.Recordset
        .FindFirst "[Referral_Source_ID] Is Null AND [Issue_ID] Is Null AND [Project_ID] Is Null AND [Funding_Area_ID] Is Null AND [HTRG_ID] Is Null"
        .Edit
        !Referral_Source_ID = Me.cboRefSource.Value
        !Issue_ID = StrIssues
        !Project_ID = Me.cboProjects.Value
        !Signpost_ID = Me.cboSignposts.Value
        !Funding_Area_ID = Me.cboFunding.Value
        !HTRG_ID = StrHTRG
        .Update
        .Requery
    End With
End Sub

Thank you.
 
liamfitz, I'm afraid your post is not coherent. I can't seem to make out head or tail from it. If you reread what you wrote you will understand where I'm coming from.

Can you please rephrase your post explaining what the problem actually is and what you added.
 
You will see I hope, from looking at the sub-routine (UpdRefInfo), that I am referencing a recordset on a subform, from another form. I then simply update a number of fields from that recordset ( using data retrieved from various input controls on the 'calling' form - or form that this code forms part of ). Now imagine it, with just the line '!Signpost_ID = Me.cboSignposts.Value', not there, ( it's about half-way down the code. That works perfectly well, i.e updates all the other listed fields in the recordset. Add back in, this particular line of code, and it simply gets to this line, and exits the routine, without executing the .Update or .Requery ( AND the 2 subsequent field updates ). Does that make sense ? Thanks.
 
It's not that as I suspected. It's about fields not being in the underlying recordset. I had an On Error exit sub, which meant I wasn't getting error messages. I should be able to fix now. Thanks.
 
The code you posted had no such error handling. Why was it omitted?

By the way, still use RecordsetClone. If you use Recordset your form will keep jumping whenever the code is run.
 
My fault, apologies. the error handler, was in a proc. tat called the one I posted ( partly why I omitted it ). Having taken out the error handler, it is indeed an 'Item not found in collection error', which I have some experience and confidence in solving. Thanks for your interest.
;)
 

Users who are viewing this thread

Back
Top Bottom