错误:“语句无效外部类型块”需要帮助 [英] Error : "statement invalid outside type block" need help here
问题描述
Hello All ..
我这里遇到了一些问题..我正在使用VB6和SQLServer 2000 ...我收到此错误语句无效的外部类型块
im发送你的代码和粗线是我得到错误
任何人都可以帮助我..我不知道我犯错了..
thankx提前
Private Sub Toolbar1_ButtonClick(ByVal Button as MSComctlLib.Button)
ID为整数
错误GoTo ChkErr
Const FIND_BUTTON = 2
Dim RsInd As New ADODB.Recordset
ID = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.RowSel,1))
如果Button.Index = 3然后''ADD
ID = 0
Dim Rs As New ADODB.Recordset
如果Rs.State = adStateOpen则Rs.Close
Rs.Open(" SELECT * FROM casemaster"),Db,adOpenKeyset,adLockPessimistic
如果Rs(" StopTran")。值= 1然后
MsgBox"交易不允许
Rs.Close
ElseIf Button.Index = 3然后
Mode =" ;添加
调用AddMode
调用ClearControl
结束如果
结束
ElseIf Button.Index = 4然后
Mode ="查看"
frmCaseMaster.Visible = False
致电ClearControl
致电查看
ElseIf Button.Index = 5然后
如果Rs.State = adStateOpen则Rs.Close
Rs.Open
Mode ="编辑"
'' Frameview.Visible = False
''cmdClearItem.Visible = True
电话编辑
结束如果
如果Button.Index = FIND_BUTTON那么
frmFind.Show
ElseIf Button.Index = 8然后
卸载我
ElseIf Button.Index = 6然后''保存
来电保存
frmCaseMaster.Visible = False
''SSTab1.Tab = 0
ElseIf Button.Index = 7然后''取消
如果txtId.Text<> ""然后
Toolbar1.Buttons.Item(3).Enabled = True
Toolbar1.Buttons.Item(4).Enabled = True
MsgBox " ID" &安培; txtId.Text& " ''被取消'
调用Grid_Data
frmCaseMaster.Visible = True
Toolbar1.Buttons.Item(7).Enabled =假''取消
结束如果
结束如果
''结束如果
退出Sub
ChkErr:
如果Err.Number> 0然后
MsgBox Err.Number& vbNewLine& Err.Description
致电ErrHand(Me.Caption,Form_Initialize)
''继续下一步
结束如果
结束Sub
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_ButtonClick(ByVal Button As MSComctlLib.Button)
ID As Integer
On Error GoTo ChkErr
Const FIND_BUTTON = 2
Dim RsInd As New ADODB.Recordset
ID = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.RowSel, 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, adLockPessimistic
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.Visible = False
Call ClearControl
Call View
ElseIf Button.Index = 5 Then
If Rs.State = adStateOpen Then Rs.Close
Rs.Open
Mode = "Edit"
''Frameview.Visible = False
''cmdClearItem.Visible = 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.Visible = False
''SSTab1.Tab = 0
ElseIf Button.Index = 7 Then '' Cancel
If txtId.Text <> "" Then
Toolbar1.Buttons.Item(3).Enabled = True
Toolbar1.Buttons.Item(4).Enabled = True
MsgBox " Id''" & txtId.Text & " '' Is canceled"
Call Grid_Data
frmCaseMaster.Visible = True
Toolbar1.Buttons.Item(7).Enabled = 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.Caption, "Form_Initialize")
''Resume Next
End If
End Sub
推荐答案
声明声明需要DIM,
将行更改为:
Dim ID As Integer
问候
Veena
Hi,
Declaration statements need "DIM",
Change the line to:
Dim ID As Integer
Regards
Veena
哦..对不起我忘记了...现在我得到这个错误..
"项目在对应于所请求名称的集合中找不到或序"按下确定后,它说找不到路径
我现在要做什么?
thankx
Oh.. sorry i forgot tht.. bt now i m getting this error..
"Item can not be found in the collection corresponding to the requested name or ordinal" and after pressing ok it says " path not found"
wht i shld do now??
thankx
你得到的错误是哪一行。?
问候
Veena
Hi,
What line are you getting Errors.?
Regards
Veena
这篇关于错误:“语句无效外部类型块”需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!