Hello All..
I m having some problem here.. i m using VB6 and SQLServer 2000... i m getting this error " statement invalid outside type block"
i m sending u the code and the bold line is where i m getting the error
can anyone help me.. i dont knw whr i m doing mistake..
thankx in advance
Private Sub Toolbar1_Button Click(ByVal Button As MSComctlLib.But ton)
ID As Integer
On Error GoTo ChkErr
Const FIND_BUTTON = 2
Dim RsInd As New ADODB.Recordset
ID = Val(MSHFlexGrid 1.TextMatrix(MS HFlexGrid1.RowS el, 1))
If Button.Index = 3 Then ' ADD
ID = 0
Dim Rs As New ADODB.Recordset
If Rs.State = adStateOpen Then Rs.Close
Rs.Open ("SELECT * FROM casemaster"), Db, adOpenKeyset, adLockPessimist ic
If Rs("StopTran"). Value = 1 Then
MsgBox " Transactions Not Allowed "
Rs.Close
ElseIf Button.Index = 3 Then
Mode = "Add"
Call AddMode
Call ClearControl
End If
End
ElseIf Button.Index = 4 Then
Mode = "View"
frmCaseMaster.V isible = False
Call ClearControl
Call View
ElseIf Button.Index = 5 Then
If Rs.State = adStateOpen Then Rs.Close
Rs.Open
Mode = "Edit"
'Frameview.Visi ble = False
'cmdClearItem.V isible = True
Call Edit
End If
If Button.Index = FIND_BUTTON Then
frmFind.Show
ElseIf Button.Index = 8 Then
Unload Me
ElseIf Button.Index = 6 Then ' Save
Call save
frmCaseMaster.V isible = False
'SSTab1.Tab = 0
ElseIf Button.Index = 7 Then ' Cancel
If txtId.Text <> "" Then
Toolbar1.Button s.Item(3).Enabl ed = True
Toolbar1.Button s.Item(4).Enabl ed = True
MsgBox " Id'" & txtId.Text & " ' Is canceled"
Call Grid_Data
frmCaseMaster.V isible = True
Toolbar1.Button s.Item(7).Enabl ed = False ' Cancel
End If
End If
'End If
Exit Sub
ChkErr:
If Err.Number > 0 Then
MsgBox Err.Number & vbNewLine & Err.Description
Call ErrHand(Me.Capt ion, "Form_Initializ e")
'Resume Next
End If
End Sub
I m having some problem here.. i m using VB6 and SQLServer 2000... i m getting this error " statement invalid outside type block"
i m sending u the code and the bold line is where i m getting the error
can anyone help me.. i dont knw whr i m doing mistake..
thankx in advance
Private Sub Toolbar1_Button Click(ByVal Button As MSComctlLib.But ton)
ID As Integer
On Error GoTo ChkErr
Const FIND_BUTTON = 2
Dim RsInd As New ADODB.Recordset
ID = Val(MSHFlexGrid 1.TextMatrix(MS HFlexGrid1.RowS el, 1))
If Button.Index = 3 Then ' ADD
ID = 0
Dim Rs As New ADODB.Recordset
If Rs.State = adStateOpen Then Rs.Close
Rs.Open ("SELECT * FROM casemaster"), Db, adOpenKeyset, adLockPessimist ic
If Rs("StopTran"). Value = 1 Then
MsgBox " Transactions Not Allowed "
Rs.Close
ElseIf Button.Index = 3 Then
Mode = "Add"
Call AddMode
Call ClearControl
End If
End
ElseIf Button.Index = 4 Then
Mode = "View"
frmCaseMaster.V isible = False
Call ClearControl
Call View
ElseIf Button.Index = 5 Then
If Rs.State = adStateOpen Then Rs.Close
Rs.Open
Mode = "Edit"
'Frameview.Visi ble = False
'cmdClearItem.V isible = True
Call Edit
End If
If Button.Index = FIND_BUTTON Then
frmFind.Show
ElseIf Button.Index = 8 Then
Unload Me
ElseIf Button.Index = 6 Then ' Save
Call save
frmCaseMaster.V isible = False
'SSTab1.Tab = 0
ElseIf Button.Index = 7 Then ' Cancel
If txtId.Text <> "" Then
Toolbar1.Button s.Item(3).Enabl ed = True
Toolbar1.Button s.Item(4).Enabl ed = True
MsgBox " Id'" & txtId.Text & " ' Is canceled"
Call Grid_Data
frmCaseMaster.V isible = True
Toolbar1.Button s.Item(7).Enabl ed = False ' Cancel
End If
End If
'End If
Exit Sub
ChkErr:
If Err.Number > 0 Then
MsgBox Err.Number & vbNewLine & Err.Description
Call ErrHand(Me.Capt ion, "Form_Initializ e")
'Resume Next
End If
End Sub
Comment