• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 251
  • Last Modified:

Cannot Update subform but using updatable query

I have a subform that is based on an updatable query. I can go into the query itself and do modifications, but cannot on the form itself. The field I am trying to update is not locked or disabled. Any ideas?
0
smoore6809
Asked:
smoore6809
  • 7
  • 4
  • 2
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Perhaps the form has been set to AllowEdits=False? Check this in the Form Design view, properties dialog, Data tab.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Sorry ... glossed over the "subform" part.

Is your subform properly linked to the mainform (i.e. the Master/Child linkfields are properly set for the subform control)? This can cause your subform to behave like this as well.
0
 
smoore6809Author Commented:
Allow edits is set to true. The subform is not linked to the main form. The main form is unbound and strictly uses combo boxes, text boxes etc. to filter information for the subform.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
When you make edits, can you actually make the edit, but it doesn't save, or does Access not allow you to make the edit at all?

Are you showing the status bar? If not, enable it and see if Access is providing any information ... Access uses this sometimes to alert you to issues.

Any code running the Enter/GotFocus/Activate events of that control (or any other events, for that matter)?
0
 
smoore6809Author Commented:
ok so it says the form is read only
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
On the subform - Form property sheet ... Data tab:

Set the Recordset  Type to Dynaset (Inconsistent Updates)

mx
0
 
smoore6809Author Commented:
setting recordset type did not help
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
What error are you getting?

Can you post the SQL for the subform Recordsource?

mx
0
 
smoore6809Author Commented:
I am getting the error form is read only.
Here is the code that populates the subform:
  DoCmd.Hourglass True
    strSQL = "Select * " _
         & "    from qryBuyerReport "
    Set cnn = New ADODB.Connection
    cnn.Open pstrConnectionString
    Set rs = New ADODB.Recordset
        With rs
                  .Open Source:=strSQL, _
                  ActiveConnection:=cnn, _
                  CursorType:=adOpenKeyset, _
                  LockType:=adLockOptimistic
           'CursorLocation:= adUseClient
            If .RecordCount = 0 Then
             MsgBox "No Records Found"
            Else
              Set Me.objSubform.Form.Recordset = rs
              Me.objSubform.Form.Requery
            End If
            .Close
        End With
    Set rs = Nothing
    Me.cboItem = ""
    Me.cboVendor = ""
    Me.cboChain = ""
    Me.cboCategory = ""
    Me.chkPassover = 0
    Me.txtBuyerCode = ""
    Me.cboSubCat = ""
    DoCmd.Hourglass False
    cnn.Close
    Set cnn = Nothing
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You must use the adUseClient CursorLocation with this method ... you've got it commented out for some reason.
0
 
smoore6809Author Commented:
When I put that back in I get the error message "Named argument not found."
0
 
smoore6809Author Commented:
Can anyone help me with this?
0
 
smoore6809Author Commented:
I waited for someone to help, but nobody could give me an answer. I solved the problem myself.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 7
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now