Run-time error '-2147352567 (80020009)': This Recordset is not updateable.

slaterino

Registered User.
Local time
Today, 16:42
Joined
Dec 2, 2008
Messages
14
I am currently getting this error message when opening a form from a DblClick function on another form.

This is the code that I am using:

Code:
Private Sub Completed_DblClick(Cancel As Integer)

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmSurveyResponses"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    
    Me.SrvID = Forms!frmSurveyResponses!SrvID

End Sub

frmSurveyResponses has set as it's RecordSource a SELECT DISTINCTROW query with data from 2 tables. These 2 tables are linked by a One-to-Many join on the SrvID field.

The field which I want the SrvID data included in has SrvID as its control source and it's name is cboSrvID. Hence, I have also tried this in my code:

Code:
Me.SrvID = Forms!frmSurveyResponses.Controls!cboSrvID

But get the same error message.

Does anyone know what could be the cause of this? Is it because of the relationship at the heart of the form that the recordset is not updateable? Are there any variables I can change which might make it updateable?

Thanks!
Russ
 
Edit: Didn't read the question properly just spotted the use of stLinkCriteria....



Code:
Private Sub Completed_DblClick(Cancel As Integer)

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmSurveyResponses"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    
    Me.SrvID = Forms!frmSurveyResponses!SrvID

End Sub
frmSurveyResponses has set as it's RecordSource a SELECT DISTINCTROW query with data from 2 tables. These 2 tables are linked by a One-to-Many join on the SrvID field.

The field which I want the SrvID data included in has SrvID as its control source and it's name is cboSrvID. Hence, I have also tried this in my code:

Code:
Me.SrvID = Forms!frmSurveyResponses.Controls!cboSrvID
But get the same error message.


Try:

Code:
Private Sub Completed_DblClick(Cancel As Integer)

    Dim stDocName As String
    Dim stLinkCriteria As String

    stLinkCriteria = "[SrvId]=" & Me![SrvID]

    stDocName = "frmSurveyResponses"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    

End Sub
Good luck :)
 
Last edited:
Can you edit the SrvID field on the form containing the code? It sounds like the source of that form is not editable.
 
Just to get this straight you are trying to open a form containing the data you wish to display from a form that has a combo box to select the SrvID?

If so then the correct syntax would be:

Private Sub Completed_DblClick(Cancel As Integer)

Dim stDocName As String
Dim stLinkCriteria As String

stLinkCriteria = "[SrvId]=" & Me![cboSrvID]

stDocName = "frmSurveyResponses"
DoCmd.OpenForm stDocName, , , stLinkCriteria

The reason you get recordset not updateable if my assumption is correct is that you are trying to set what the control is not display a record...

also you might try something like:

DoCmd.OpenForm "Your_form_name", , , _
"[Yourtable.SrvID]=" & "" & Me.SrvID.Column(0) & ""

Column (0) being the first column in the select query of your combo box...
 

Users who are viewing this thread

Back
Top Bottom