Hi

I have the following code however I have a problem when I compile it runs but with clicking on the forward button it gives me sub or function not defined error for btnForward_Click() procedure . I couldn't figure it out, can anyone else does?

Many Thanks

VB Code:
  1. Option Explicit
  2.     ' create new activeX data objects for a database connection and a recordset
  3.     Dim conn As ADODB.Connection
  4.     Dim rs As ADODB.Recordset
  5.    
  6.  
  7. Private Sub Form_Load()
  8.     ' open a connection to the student model database
  9.     Set conn = New ADODB.Connection
  10.     conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  11.            "Data Source=" & App.Path & "\student_model.mdb;" & _
  12.            "User Id=admin;" & _
  13.            "Password=;"
  14.     ' open a recordset
  15.     Set rs = New ADODB.Recordset
  16.     rs.CursorType = adOpenDynamic
  17.     ' populate the recordset
  18.     rs.Source = "Select * from users"
  19.     rs.ActiveConnection = conn
  20.     rs.Open
  21.     showfields
  22.  
  23. End Sub
  24.  
  25. Private Sub btnPrevious_Click() ' procedure to navigate the student model database list of names
  26.     'On Error GoTo Err_Init
  27.     PlaySound App.Path & "\click.wav", 0&, 0&
  28.     rs.MovePrevious
  29.     showfields
  30.    
  31.     Exit Sub
  32.  
  33. 'Err_Init:
  34.     'HandleError "btnPrevious_Click", Err.Number, Err.Description
  35.    
  36. End Sub
  37.  
  38. Private Sub btnNext_Click() ' procedure to navigate the student model database list of names
  39.     'On Error GoTo Err_Init
  40.     PlaySound App.Path & "\click.wav", 0&, 0&
  41.     rs.MoveNext
  42.     showfields
  43.  
  44.     Exit Sub
  45.  
  46. 'Err_Init:
  47.     'HandleError "btnNext_Click", Err.Number, Err.Description
  48.    
  49. End Sub
  50.  
  51. Private Sub showfields() ' procedure to show current current record in a textbox
  52.     'On Error GoTo Err_Init
  53.     If rs.BOF Then rs.MoveFirst
  54.     If rs.EOF Then rs.MoveLast
  55.     txtStatus.Text = rs.Fields("userStatus")
  56.     txtNames.Text = rs.Fields("userName")
  57.  
  58.     Exit Sub
  59.  
  60. 'Err_Init:
  61.     'HandleError "showfields", Err.Number, Err.Description
  62.    
  63. End Sub
  64.  
  65. Private Sub btnForward_Click() ' procedure to continue application and send information to log file
  66.     'On Error GoTo Err_Init
  67.     Dim currentStatus As Integer
  68.     PlaySound App.Path & "\click.wav", 0&, 0&
  69.     currentStatus = txtStatus.Text
  70.     dataModule.userName = txtNames.Text
  71.     SetLogDetails
  72.     SetLog (MyTime & "; " & MyDate & "; " & "Application start" & "; " & dataModule.userName)
  73.     ' direct user to cognitive style test if not already completed
  74.     If currentStatus = 1 Then
  75.         frmChooseAgent.Show
  76.         frmLogin.Hide
  77.         Else: frmTest1.Show
  78.         frmLogin.Hide
  79.         End If
  80.     ' close recordset and connection to database
  81.     rs.Close
  82.     conn.Close
  83.     Set rs = Nothing
  84.     Set conn = Nothing
  85.    
  86.     Exit Sub
  87.  
  88. 'Err_Init:
  89.     'HandleError "btnForward_Click", Err.Number, Err.Description
  90.    
  91. End Sub