sub or function not defined
I am new to VB6 and prctically dont know anything about it. :confused:
After consulting some books i made a prog for employee management.
On clicking the Add New button for employee i get a compiler error saying sub or function not defined.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Command11_Click()
HideButtons
Data1.Recordset.AddNew
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Above given is the line it shows for the error.
Also it gives an error for the last portion of the code.The entire code is given .I gave spaces for names of labels but in that last part of code , i think it is giving an error because of that.
If anyone could give thier time and patience to it , I would be grateful.
Thanks
:D
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub OLE1_Updated(Code As Integer)
End Sub
Private Sub Command1_Click()
Mm.Show
End Sub
Private Sub File1_Click()
End Sub
Private Sub Command11_Click()
HideButtons
Data1.Recordset.AddNew
End Sub
Private Sub Command2_Click()
Data1.Recordset.MoveFirst
End Sub
Private Sub Command3_Click()
Data1.Recordset.MoveLast
End Sub
Private Sub Command4_Click()
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
MsgBox "You are on the first record"
Data1.Recordset.MovePrevious
End If
End Sub
Private Sub Command5_Click()
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
MsgBox "You are on the last record"
Data1.Recordset.MoveLast
End If
End Sub
Private Sub Dept_Click()
End Sub
Private Sub Command6_Click()
On Error Resume Next
Data1.Recordset.Delete
If Not Data1.Recordset.EOF Then
Data1.Recordset.MoveNext
ElseIf Not Data1.Recordset.BOF Then
Data1.Recordset.MovePrevious
Else
MsgBox "This was the last record in the table"
End If
End Sub
Private Sub Command7_Click()
On Error GoTo CancelUpdate
Data1.Recordset.Update
ShowButtons
Exit Sub
CancelUpdate:
MsgBox Err.Description
Data1.Recordset.CancelUpdate
ShowButtons
End Sub
Private Sub Command8_Click()
Data1.Refresh
Data1.Recordset.FindFirst "Name='" & prevName & "'"
ShowButtons
End Sub
Sub ShowButtons()
AddBttn.Visible = True
DeleteBttn.Visible = True
OkBttn.Visible = False
CancelBttn.Visible = False
End Sub
Private Sub Data1_Error(DataErr As Integer, Response As Integer)
MsgBox Err.Description
Response = 0
Data1.Recordset.CancelUpdate
End Sub
###########################################################################
(ERROR PORTION)
Private Sub Data1_Validate(Action As Integer, Save As Integer)
Dim Reply
If txtStaffNo.DataChanged Or txtDeptCode.DataChanged Or _
txtSectionCode.DataChanged Or txtDesignation.DataChanged Or _
txtDateofLastPromotion.DataChanged Or txtDateofJoining.DataChanged Or _
txtName.DataChanged Or txtDateofJoin_Section.DataChanged Then
Reply = MsgBox("Record has been changed. Save?", vbYesNo)
If Reply = vbNo Then
Save = False
End If
End If
End Sub
###########################################################################
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

