Problem:
I created a form that is attached to a Linked Table and not an access table. The form saves the information to the linked table which is about 8-10 fields. My problem is I am getting duplicates saved to the form which no fields changed & I don't want that to be saved. It is a history table but I only want to save it if a field value changed or a blank field changed to having a value. Below is an example
Example of what i am looking for
Fields
Record 1 = 4 4 4 - - 4 4
Record 1 = 4 4 4 4 - 4 4
Record 1 = 4 5 4 4 - 4 5
But instead I getting this below duplicates
Fields
Record 1 = 4 4 4 - - 4 4
Record 1 = 4 4 4 - - 4 4
Record 1 = 4 4 4 - - 4 5
It will save a record if its the same.
Here is also my code.. Thank you again!
' On Error GoTo Error_trap
Dim rs As DAO.Recordset
Dim flag As Boolean
Dim Dbs As DAO.Database
'MsgBox ("Form_Unload")
Cancel = False
flag = validateGS(False)
If flag = False Then
Cancel = True
Me!GS_L.SetFocus
'Writes to the RB_TBL
Else
Set Dbs = CurrentDb
Set rs = Dbs.OpenRecordset("RB_TBL")
Debug.Print " start code here "
rs.Edit
rs!LOC_ID = Me.LOC_ID
rs!GS_L = Me.GS_L
rs!GS_LO = Me.GS_LO
rs!REF = Me.REF
rs!GS_DA = Me.GS_DA
rs!GS_P = Me.GS_P
rs!WH_L = Me.WH_L
rs!WH_LO = Me.WH_LO
rs!OP_L = Me.OP_L
rs!OP_LO = Me.OP_LO
rs!OP_REF= Me.OP_REF
rs!OP_DAT = Me.OP_DAT
rs!OP_REP = Me.OP_REP
rs!INSERT_DATE = Now()
rs.Update
Debug.Print " close code here "
rs.Close
Set rs = Nothing
End If
' Exit Sub
'Error_trap:
' Debug.Print "Error: " & Err.Number & vbTab & Err.Description
' MsgBox "Error: " & Err.Number & vbTab & Err.Description
' If Err.Number = 123456 Then
' MsgBox "XXXXX"
' Else
'
' End If
'
'Exit Sub
'Resume
End Sub
I created a form that is attached to a Linked Table and not an access table. The form saves the information to the linked table which is about 8-10 fields. My problem is I am getting duplicates saved to the form which no fields changed & I don't want that to be saved. It is a history table but I only want to save it if a field value changed or a blank field changed to having a value. Below is an example
Example of what i am looking for
Fields
Record 1 = 4 4 4 - - 4 4
Record 1 = 4 4 4 4 - 4 4
Record 1 = 4 5 4 4 - 4 5
But instead I getting this below duplicates
Fields
Record 1 = 4 4 4 - - 4 4
Record 1 = 4 4 4 - - 4 4
Record 1 = 4 4 4 - - 4 5
It will save a record if its the same.
Here is also my code.. Thank you again!
' On Error GoTo Error_trap
Dim rs As DAO.Recordset
Dim flag As Boolean
Dim Dbs As DAO.Database
'MsgBox ("Form_Unload")
Cancel = False
flag = validateGS(False)
If flag = False Then
Cancel = True
Me!GS_L.SetFocus
'Writes to the RB_TBL
Else
Set Dbs = CurrentDb
Set rs = Dbs.OpenRecordset("RB_TBL")
Debug.Print " start code here "
rs.Edit
rs!LOC_ID = Me.LOC_ID
rs!GS_L = Me.GS_L
rs!GS_LO = Me.GS_LO
rs!REF = Me.REF
rs!GS_DA = Me.GS_DA
rs!GS_P = Me.GS_P
rs!WH_L = Me.WH_L
rs!WH_LO = Me.WH_LO
rs!OP_L = Me.OP_L
rs!OP_LO = Me.OP_LO
rs!OP_REF= Me.OP_REF
rs!OP_DAT = Me.OP_DAT
rs!OP_REP = Me.OP_REP
rs!INSERT_DATE = Now()
rs.Update
Debug.Print " close code here "
rs.Close
Set rs = Nothing
End If
' Exit Sub
'Error_trap:
' Debug.Print "Error: " & Err.Number & vbTab & Err.Description
' MsgBox "Error: " & Err.Number & vbTab & Err.Description
' If Err.Number = 123456 Then
' MsgBox "XXXXX"
' Else
'
' End If
'
'Exit Sub
'Resume
End Sub