Private Sub LogRoutine()
Const MyTable As String = "tblSampleSubmission"
Const MyField As String = "SampleName"
Dim DB As DAO.Database
Dim rs As DAO.Recordset
Dim intCounter As Double
Dim LastDub As Double
Dim minID, maxID, stdID As Long 'Used for randomly selected ID from table of standards
Dim stdName As String
Set DB = CurrentDb
Set rs = DB.OpenRecordset(MyTable)
'Find maximum and minimum ID number in tblStandards
maxID = DMax("StandardID", "tblStandards")
minID = DMin("StandardID", "tblStandards")
For intCounter = Me.TxtStartValue To Me.txtEndValue Step Me.cboIncrement
rs.AddNew
rs.Fields(MyField) = Me.SamPre & intCounter & Me.SamSuf
rs.Fields("SubmissionNumber") = Me.SubNum
rs.Fields("CustomerID") = Me.CustomerID
rs.Fields("SamplePrep") = True
rs.Fields("Fusion") = True
rs.Fields("XRF") = True
rs.Fields("LOI") = True
rs.Fields("3StageLOI") = Me.chk3StageLOI
rs.Fields("Magnasat") = Me.chkMagnasat
rs.Fields("DavisTube") = Me.chkDavisTube
rs.Fields("RecWt") = Me.chkRecWt
rs.Fields("Sizing") = Me.Sizing
rs.Fields("Moisture") = Me.Moisture
rs.Fields("EnteredBy") = Me.cboEnteredBy
rs.Fields("Priority") = Me.cboPriority
rs.Update
addString = ""
samplecount = samplecount + 1
If samplecount = 25 Then
'Add duplicate record
addString = " DUP"
rs.AddNew
rs.Fields(MyField) = Me.SamPre & intCounter & Me.SamSuf & " DUP"
rs.Fields("SubmissionNumber") = Me.SubNum
rs.Fields("CustomerID") = Me.CustomerID
rs.Fields("SamplePrep") = True
rs.Fields("Fusion") = True
rs.Fields("XRF") = True
rs.Fields("LOI") = True
rs.Fields("3StageLOI") = Me.chk3StageLOI
rs.Fields("Magnasat") = Me.chkMagnasat
rs.Fields("DavisTube") = Me.chkDavisTube
rs.Fields("RecWt") = Me.chkRecWt
rs.Fields("Sizing") = False
rs.Fields("Moisture") = False
rs.Fields("EnteredBy") = Me.cboEnteredBy
rs.Fields("Priority") = Me.cboPriority
rs.Update
'Add Standard
stdID = stdCnt
stdName = DFirst("standard", "tblStandards", "[standardid]= " & stdID)
rs.AddNew
rs.Fields(MyField) = "STD1:" & stdName
rs.Fields("SubmissionNumber") = Me.SubNum
rs.Fields("CustomerID") = Me.CustomerID
rs.Fields("SamplePrep") = Me.SamplePrep
rs.Fields("Fusion") = Me.Fusion
rs.Fields("XRF") = Me.XRF
rs.Fields("LOI") = True
rs.Fields("Sizing") = False
rs.Fields("Moisture") = False
rs.Fields("EnteredBy") = Me.cboEnteredBy
rs.Update
stdCnt = stdCnt + 1
samplecount = 0
End If
Next intCounter
rs.Close
DB.Close
Set rs = Nothing
Set DB = Nothing
Exit_EnterBlast_Click:
Exit Sub
Err_EnterBlast_Click:
MsgBox Err.Description
Resume Exit_EnterBlast_Click
End Sub