So, I'm trying to figure this one out. If a record exists, I want it to recall the existing record and have it populate the field. If it doesn't, I want it to automatically write those fields to the new table.
Code:
Private Sub LP__BeforeUpdate(Cancel As Integer)
Dim db As Database, tb As Recordset
Set db = CurrentDb
Set tb = db.OpenRecordset("Select * from [LP Table] where LPNUM =" & Me!LOADPLANNUM)
If Not tb.EOF Then
MsgBox ("This record already exists. Press 'OK' to load existing Master.")
DoCmd.FindRecord Me!LOADPLANNUM
End If
If tb.EOF Then
Me!SSLBKNGNUM = tb!BKGNUM
Me!VSL = tb!VSL
Me![# PKGS] = "1X" & tb!SIZE]
Me![ULTIMATE DESTINATION] = tb![DEST]
Me![MARKS AND NO'S] = "IN CNTR NO: " & tb![CNTRNUM] & Chr(13) & Chr(10) & "SN:" & tb![SEAL#]
Me![# PKGS] = "1X" & tb![SIZE]
Me![PORT OF UNLOADING] = tb![DEST]
Me![PLACE OF DELIVERY] = tb![DEST]
End If
tb.Close
Set db = Nothing
End Sub