Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.
Private Sub S_Click() If MIRROR.Value > "" Then Dim NewMDRNumber As Integer 'get the selected mdr Dim myDMR As Integer myDMR = MIRROR.Value 'fill NewMDRNumber number with next mdr number NewMDRNumber = DLookup("myDMR", "GetNextDMRID") 'populate forms recored set with select statement Set RST = New ADODB.Recordset RST.Open "Select * from [DMR Tracking] Where [DMR#] = " & myDMR & "", _ CurrentProject.Connection, adOpenKeyset, adLockOptimistic Set Forms("Type of DMR").Recordset = RST 'Duplicate the record With Me.RecordsetClone .AddNew ![DMR#] = NewMDRNumber ![DATE Issued] = Me.[DATE Issued] ![TYPE OF DMR] = Me.[TYPE OF DMR] ![PART NUMBER] = [PART NUMBER] ![PART NAME] = [PART NAME] ![Program] = [Program] ![Customer] = [Customer] ![SUPPLIER] = [SUPPLIER] ![Area] = [Area] ![LOT NUMBER] = [LOT NUMBER] ![QTY SUSPECT] = [QTY SUSPECT] ![PPM QUANTITY] = [PPM QUANTITY] ![WHERE LOCATED] = [WHERE LOCATED] ![WHO PREPARED] = [WHO PREPARED] ![QA Eng] = [QA Eng] ![JobNumber] = [JobNumber] ![PINNumber] = [PINNumber] .Update 'Save the primary key value, to use as the foreign key for the related records. .Bookmark = .LastModified 'Display the new duplicate. Me.Bookmark = .LastModified End With Exit_Handler: Exit Sub Err_Handler: MsgBox "Error " & Err.Number & " - " & Err.Description, , "cmdDupe_Click" Resume Exit_Handler Else MsgBox "Select the MDR to duplicate." End If End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.