- Local time
- Today, 16:22
- Joined
- Feb 19, 2002
- Messages
- 45,774
The original question was about how to change "all" the places where material shows when it is changed in the primary table.
it does that , the original question was how to a report all the product numbers that part was located in and if possible record the old text and new text in that report
Private Sub Form_BeforeUpdate(Cancel As Integer)
docmd.RunSQL "INSERT INTO stocklistchanges select * FROM stocklist " & _
"WHERE MaterialID=" & MaterialID
End Sub
That is not a report, but a query?Code:Private Sub Form_BeforeUpdate(Cancel As Integer) docmd.RunSQL "INSERT INTO stocklistchanges select * FROM stocklist " & _ "WHERE MaterialID=" & MaterialID End Sub
i tried this yesterday and it reports the changes i have made . but the problem with this is it reports all the fields which i would imagine soon fills the database? i had to change the id and stocknumber to index to no duplicates. so still not sure if i did this correct ??
steve
View attachment 107753
Private Sub Material_AfterUpdate()
Dim OldValue As String
Dim NewValue As String
Dim MaterialID As Double
MaterialID = Me.MaterialID
OldValue = Me.Material.OldValue
NewValue = Me.Material
DoCmd.RunSQL "INSERT INTO TblDataChanges ( MaterialID, ChangeDate, ControlName, OldValue, NewValue ) VALUES ('" & MaterialID & "',Now(),'Material' ,'" & OldValue & "', '" & NewValue & "');"
Exit Sub
End Sub