我是刚刚学VB的,想看看别人做的系统,可是运行总是出现错误~~
tztz520(午夜逛街),你能不能留下你的QQ(邮箱也行)号给我,我发个系统的代码给你,帮我弄一下!
我实例化mrc化后又出现了如下错误: ”实时错误’3704’: 对角关闭时,不允许操作’
,
各位大哥有人看过<<Visual Basic 6.0数据库系统开发实例导航 >>这本书吗!!!请大家帮我解决一个错误:”
工程--引用--引用microsoft activex data object 2.x library也打勾了.
情况是这样的:在一个添加员工信息窗口中,输入信息后,点击”保存”按钮后,就也出现了:”实时错误’3704’: 对角关闭时,不允许操作’
”.代码如下: Option Explicit
Dim mblChange As Boolean
Public txtSQL As String
Dim mrc As new ADODB.Recordset
Private Sub cmdSave_Click()
Dim intCount As Integer
Dim txtSQL As String
Dim MsgText As String
Dim sMeg As String
Dim i As Integer
…………………………..
If gintMode = 1 Then
txtSQL = "select * from manrecord where ygid='" & Trim(txtItem(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
注:运行时错误在这里出现: If mrc.EOF = False Then
MsgBox "已经存在此员工档案编号的记录!", vbOKOnly + vbExclamation, "警告"
txtItem(0).SetFocus
txtItem(0).SelStart = 0
txtItem(0).SelLength = Len(txtItem(0))
Exit Sub
End If
mrc.Close
End If
'先删除已有记录
txtSQL = "delete from manrecord where ygid='" & Trim(txtItem(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
'再加入新记录
txtSQL = "select * from manrecord"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
For intCount = 0 To 2
mrc.Fields(intCount) = Trim(txtItem(intCount))
Next intCount
mrc.Fields(3) = Trim(cboItem.Text)
For intCount = 3 To 18
mrc.Fields(intCount + 1) = Trim(txtItem(intCount))
Next intCount
mrc.Update
If gintMode = 1 Then
MsgBox "记录添加成功!", vbOKOnly + vbExclamation, "警告"
For i = 0 To 18
txtItem(i).Text = ""
mblChange = False
Next i
frmManRecord1.Show
frmManRecord1.ZOrder 0
frmManRecord.ShowTitle
frmManRecord.txtSQL = "select * from manrecord"
frmManRecord.ShowData
frmManRecord.ZOrder 1
Else
MsgBox "记录修改成功!", vbOKOnly + vbExclamation, "警告"
Unload Me
frmManRecord.ShowTitle
frmManRecord.txtSQL = "select * from manrecord"
frmManRecord.ShowData
frmManRecord.ZOrder 0
End If
gintMode = 0
End Sub
Private Sub Form_Load()
Dim MsgText As String
Dim intCount As Integer
With cboItem
.AddItem "男"
.AddItem "女"
End With
If gintMode = 1 Then
Me.Caption = Me.Caption & "添加"
cboItem.ListIndex = 0
ElseIf gintMode = 2 Then
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
With mrc
For intCount = 0 To 2
txtItem(intCount) = .Fields(intCount)
Next intCount
If Not IsNull(!ygsex) Then
cboItem = !ygsex
End If
For intCount = 3 To 18
If Not IsNull(.Fields(intCount + 1)) Then
txtItem(intCount) = .Fields(intCount + 1)
End If
Next intCount
End With
txtItem(0).Enabled = False
End If
mrc.Close
Me.Caption = Me.Caption & "修改"
End If
mblChange = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
'MsgBox "realy want to quit?", vbOKOnly + vbExclamation, "quit"
End Sub
Private Sub txtItem_Change(Index As Integer)
'有变化设置gblchange
mblChange = True
End Sub
txtItem(Index).SelStart = 0
txtItem(Index).SelLength = Len(txtItem(Index))
End Sub
Private Sub txtItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
tztz520(午夜逛街),你能不能留下你的QQ(邮箱也行)号给我,我发个系统的代码给你,帮我弄一下!
我实例化mrc化后又出现了如下错误: ”实时错误’3704’: 对角关闭时,不允许操作’
,
各位大哥有人看过<<Visual Basic 6.0数据库系统开发实例导航 >>这本书吗!!!请大家帮我解决一个错误:”
工程--引用--引用microsoft activex data object 2.x library也打勾了.
情况是这样的:在一个添加员工信息窗口中,输入信息后,点击”保存”按钮后,就也出现了:”实时错误’3704’: 对角关闭时,不允许操作’
”.代码如下: Option Explicit
Dim mblChange As Boolean
Public txtSQL As String
Dim mrc As new ADODB.Recordset
Private Sub cmdSave_Click()
Dim intCount As Integer
Dim txtSQL As String
Dim MsgText As String
Dim sMeg As String
Dim i As Integer
…………………………..
If gintMode = 1 Then
txtSQL = "select * from manrecord where ygid='" & Trim(txtItem(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
注:运行时错误在这里出现: If mrc.EOF = False Then
MsgBox "已经存在此员工档案编号的记录!", vbOKOnly + vbExclamation, "警告"
txtItem(0).SetFocus
txtItem(0).SelStart = 0
txtItem(0).SelLength = Len(txtItem(0))
Exit Sub
End If
mrc.Close
End If
'先删除已有记录
txtSQL = "delete from manrecord where ygid='" & Trim(txtItem(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
'再加入新记录
txtSQL = "select * from manrecord"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
For intCount = 0 To 2
mrc.Fields(intCount) = Trim(txtItem(intCount))
Next intCount
mrc.Fields(3) = Trim(cboItem.Text)
For intCount = 3 To 18
mrc.Fields(intCount + 1) = Trim(txtItem(intCount))
Next intCount
mrc.Update
If gintMode = 1 Then
MsgBox "记录添加成功!", vbOKOnly + vbExclamation, "警告"
For i = 0 To 18
txtItem(i).Text = ""
mblChange = False
Next i
frmManRecord1.Show
frmManRecord1.ZOrder 0
frmManRecord.ShowTitle
frmManRecord.txtSQL = "select * from manrecord"
frmManRecord.ShowData
frmManRecord.ZOrder 1
Else
MsgBox "记录修改成功!", vbOKOnly + vbExclamation, "警告"
Unload Me
frmManRecord.ShowTitle
frmManRecord.txtSQL = "select * from manrecord"
frmManRecord.ShowData
frmManRecord.ZOrder 0
End If
gintMode = 0
End Sub
Private Sub Form_Load()
Dim MsgText As String
Dim intCount As Integer
With cboItem
.AddItem "男"
.AddItem "女"
End With
If gintMode = 1 Then
Me.Caption = Me.Caption & "添加"
cboItem.ListIndex = 0
ElseIf gintMode = 2 Then
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
With mrc
For intCount = 0 To 2
txtItem(intCount) = .Fields(intCount)
Next intCount
If Not IsNull(!ygsex) Then
cboItem = !ygsex
End If
For intCount = 3 To 18
If Not IsNull(.Fields(intCount + 1)) Then
txtItem(intCount) = .Fields(intCount + 1)
End If
Next intCount
End With
txtItem(0).Enabled = False
End If
mrc.Close
Me.Caption = Me.Caption & "修改"
End If
mblChange = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
'MsgBox "realy want to quit?", vbOKOnly + vbExclamation, "quit"
End Sub
Private Sub txtItem_Change(Index As Integer)
'有变化设置gblchange
mblChange = True
End Sub
txtItem(Index).SelStart = 0
txtItem(Index).SelLength = Len(txtItem(Index))
End Sub
Private Sub txtItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
If gintMode = 1 Then '这里,而mrc还没有实例化,不能被关掉的。
End If
mrc.Close
‘你的出错信息,应该是对象已经关闭,不能操作吧。