Share via

Setting default value on subform generated error 3164 code field can not be updated

Anonymous
2018-02-17T20:40:54+00:00

I am working with setting up user entered default values for many of the controls on the subform of my order entry form.  One of my controls is causing error code #3164.  The error message says the field can not be updated because another user or process has locked the corresponding record or process.  

While entering line items on the subform of the OrderEntry Form, the user clicks on the SelectFabBut which open the orderlineitemFabricSelect form. When the user is finished with this form they click on the close button which hides the form but does not close it.  At first I thought this was causng the problem, but I no longer think so. The orderlineitemFabricSelect form is closed by code when the user is returned to the orderentry subform

For some reason the control which is causing the problem (FabricID) is showing a default value even before the user has selected a fabric.  At one time I did use a default value in the table but I thought I got rid of it.  I have checked the underlying fabric table and the qry which the subform orderDraperyLineItems are based on.  Both have no entry on the property sheet for a default value. Interestingly the default value turns out to be the last fabricID selected by the user.  I guess this kind of makes sense except the default value is set when the orderlineitemfabricselect form is open. This is continues to be true even if the orderentry form is closed and even if application is closed and then reopened

Here is the code that sets the defaults

Private Sub SelectFabBut_Click()

DoCmd.OpenForm "orderlineitemfabricselect", windowmode:=acDialog

   Me.txtFabricID = Forms!orderlineitemfabricselect.cboColor1

   Me.Drop = Forms!orderlineitemfabricselect.Drop

   Me.Group = Forms!orderlineitemfabricselect.Group

   Me.txtFabWidth = Forms!orderlineitemfabricselect.FabWidth

   Me.txtFabricID.DefaultValue = """" & Forms!orderlineitemfabricselect.cboColor1 & """"

   Me.Color.DefaultValue = """" & Forms!orderlineitemfabricselect.cboColor1.Column(1) & """"

   Me.PatternName.DefaultValue = """" & Forms!orderlineitemfabricselect.cboPatternName1.Column(1) & """"

 DoCmd.Close acForm, "orderlineitemFabricSelect"

End Sub

So here what happens

I open a new record and the FabricID is filled in with the code of the last FabricID entered during the last session.

Then I complete the order line including selecting a new FabricID.  The new line is waiting below and the defaults correctly appear;

however when I attempt to enter a quantity ( the first control on the new line)  into the new line, The quantity goes to 0, the FabricID default value disappears and I get the error message "Field can not be updated"

UGH!!! I am really hoping someone out there has run into a similar situation and can give me some guidance.  I have been trying to find a solution all week and no luck.  If I comment out the lines where the fabricID default is set then everything works just fine..... but I really would like to get the default working.  It would make orderentry so much easier.

Thanks so much

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2018-02-17T22:24:39+00:00

    To provide the most helpful answer, some more information is needed.

    Would you be able to save a copy of the file without any sensitive data to OneDrive, Google Drive or Dropbox and post the link to the file as a reply.

    Thanks.

    0 comments No comments