Hi,
I have written the following code. I want to change the status of my order when reminaing products shipped is equal to zero. When I run this code I get error " Cannot update. Database or object is read only". I think that this error is because that I am using the front end of the database. Can somebody please guide me.
 
 
	
	
	
		
 I have written the following code. I want to change the status of my order when reminaing products shipped is equal to zero. When I run this code I get error " Cannot update. Database or object is read only". I think that this error is because that I am using the front end of the database. Can somebody please guide me.
		Code:
	
	
	Private Sub Form_AfterUpdate()
 
    Dim dbs As DAO.Database
 
 
    Dim rstTest As DAO.Recordset
 
    Dim strQuery As String
 
    strQuery = "SELECT OrderingT.Order_ID, OrderingT.UnitsRequested,OrderingT.OrderStatus, ([UnitsRequested])-Count([Product_ID]) AS [The Remaining Units] " + _
    "FROM (OrderingT INNER JOIN PackingSlipT ON OrderingT.Order_ID = PackingSlipT.Order_ID) INNER JOIN ProductT ON PackingSlipT.PackingSlip_ID = ProductT.PackingSlip_ID " + _
    "WHERE (PackingSlipT.PackingSlip_ID = " & Form.Tag & ") " + _
    "GROUP BY OrderingT.Order_ID, OrderingT.UnitsRequested , OrderingT.OrderStatus;"
 
    Dim db As Database
    Set db = CurrentDb
 
    Set rstTest = db.OpenRecordset(strQuery)
 
    If Not rstTest.EOF Then
        MsgBox "Order: " & rstTest!Order_ID & " has " & rstTest![The Remaining Units] & " units left"
 
    End If
 
    If rstTest![The Remaining Units] = 0 Then
         MsgBox "You cannot add more product"
 
         MsgBox rstTest!OrderStatus
 
         rstTest.Edit
         rstTest!OrderStatus = "Completed"
         rstTest.Update
 
         MsgBox rstTest!OrderStatus
     End If
 
 
End Sub 
	 
 
		 
 
		 
 
		