[RESOLVED] How to use IF NOT
Can anyone tell how to use the If Not so I don't have to use an exit sub to get out of the procedure
This works but I want to remove the exit sub
VB Code:
Public Sub FillLabels()
If Not (objrec.BOF = True) Or (objrec.EOF = True) Then
Exit Sub
End If
txtJobDescription = objrec.Fields("Job_Description").Value & " "
txtSubTotal.Text = Format$(objrec.Fields("Sub_Total").Value & " ", "Currency")
lblAddVAT = Format$(objrec.Fields("VAT").Value & " ", "Currency")
lblNewTotal = Format$(objrec.Fields("Total").Value & " ", "Currency")
End Sub
here is the code for the navigation
VB Code:
Public Sub Forward()
'If the recordset is not at the end of file....
If objrec.EOF = False Then
'....Move to the next record
objrec.MoveNext
'Call the Select_Case procedure to refill the labels with the next record
Select_Case
If objrec.EOF Then
'This will prevent the user from moving to
'the EOF Marker if he or she is on the last
'record.
objrec.MoveLast
End If
Else
If objrec.BOF Then
Exit Sub
Else
objrec.MoveNext
End If
End If
End Sub
I have a forward and back navigation buttons on my toolbar and use it to move forward and back records. I have tried using IF NOT around the booleans but When it reaches the last record it will crash saying 'Either BOF or EOF is True.......'
I want to be able to remove the Exit Sub becuase I have been told it's lazy programming to exit a sub routine