Would anyone know why this piece of code will not add the record count to the text field txtReference
John
Code:
'** Re-Checks reference number to ensure it has not been allocated. If so adds recordcount to reference
Dim rstRefer As DAO.Recordset
Dim strRef As String
strRef = "SELECT Reference FROM tblClaimants WHERE Reference = '" & txtRef & "'"
Set rstRefer = CurrentDb.OpenRecordset(strRef)
If rstRefer.RecordCount >= 1 Then
'-- If record count is > 1 move to the last record to retrieve an accurate count
rstRefer.MoveLast
intRecCount = rstRefer.RecordCount
Me!txtRef = Int(Me!txtRef + intRecCount)
End If
rstRefer.Close
John