Error 2448 Can't Assign Value

Access11

Registered User.
Local time
Yesterday, 21:47
Joined
Nov 21, 2012
Messages
15
Morning all,

I was wondering if someone could help with this code. I have a form and a subform. I want to pass the value of both form and subform to my Master2 table, however I get an error. Revsion No is an automuber field. The section in blue seeems to be the issue. Any help would be greatly appreciated.

Private Sub cmdSaveRevision_Click()
Dim strSql As String
Me.[Revision No] = DMax("[Revision No]", "tblMaster2") + 1
Me.Revision_Date = Now()

On Error GoTo Err_Handler
If Me.Dirty Then Me.Dirty = False
Err_Handler:
If Err.Number = 2101 Then
Exit Sub
End If
strSql = "INSERT INTO tblMaster2 SELECT * FROM tblTempMaster"
CurrentDb.Execute strSql, dbFailOnError
DoCmd.Close acForm, Me.Name
Forms!frmBOMSelectItem.sfrmBOMNo.Form.Requery
End Sub
 
Revsion No is an automuber field.

Autonumber in Access terms or just your term for it.

You can have your own numeric identifier which you can control, but I don't think you can
change a value in a true autonumber.
 
It's an Access Autonumber. I have this code on another project and it works, only difference is this project has the subform added to the main form. The code should assign a new number using Dmax function to add +1 before it is added to the table.
 
If this is a bound form,I don't think you are able to assign a value to the bound control.

I did some googling -- try this a search term
error 2448 you can't assign a value to this object
 
Yes the textbox is bound to the original Master table. This is the same scenario I have on my other project. I will look into the search
 

Users who are viewing this thread

Back
Top Bottom