I played around with your code and changed a few things.
At the top of every module, you should have these two lines
Code:
Option Compare Database
Option Explicit
Because of the "Option Explicit" line, I found an error. Buried in the code was a declaration line
Code:
Dim branchloss As Integer
But in the code you have
Code:
intBranchLoss = Me.txtBranchLoss.Value
I always have any declarations at the top of the subroutine........
I changed the IF..ELSEIF..END IF statements to SELECT CASE. Much easier to read and maintain.
Lastly, the reason the "NEXT" button wouldn't display "Finish" is because the code to change the caption of the next button was in the wrong place.
You have it at the top of the sub. But what is the text just above it?? Code to close the form!
So the code to change the caption should be at the bottom of the sub.
Once you move to the 10th tab (index 9), you should change the caption of the Next button, not the next time you click on the "Next" button.
Code:
Option Compare Database
Option Explicit
Private Sub btnNext_Click()
'Basics*
Dim intStep As Integer
Dim intStart As Integer
Dim intbranchloss As Integer
Me.txtTabValue = Me.tabWizard
Me.txtCount.Value = Me.txtCount + 1
intStart = Me.txtCount.Value
If Me.tabWizard = Me.tabWizard.Pages.Count - 1 Then
DoCmd.Close
Exit Sub
End If
'/end of Basics*
'Crops*
Select Case CropID
Case 0
'do nothing
Case 2
'do nothing
Case 3 'Lentils
intStep = 5
Select Case Me.tabWizard
Case 0
Me.tabWizard = 1
Case 1
Me.tabWizard = 2
Case 2
Me.tabWizard = 3
Case 3
Me.tabWizard = 4
Case 4
Me.tabWizard = 9
End Select
Case 1, 5 'Canola and Mustard
intStep = 5
intbranchloss = Me.txtBranchLoss
Select Case Me.tabWizard
Case 0
Me.tabWizard = 1
Case 1
Me.tabWizard = 5
Case 5
Me.tabWizard = 6
Case 6
Me.tabWizard = intbranchloss
Case intbranchloss
Me.tabWizard = 9
End Select
Case Else
End Select
If Me.tabWizard = 9 Then
Me.btnNext.Caption = "&Finish"
Else
Me.btnPrevious.Enabled = True
End If
Me.Caption = "Count Wizard - Step " & intStart & " of " & intStep
End Sub