【求助】实时错误3219 在此环境中不允许操作 请大侠指点啊
请大侠帮忙看看有什么问题啊,我一直都找不出来。初学者每次点击Command2插入图片到image空间后,点击保存,就会有错误提示“实时错误3219 在此环境中不允许操作”
调试错误是在“rs.Fields("图片") = str.Read”这代码,如果没有插入图片,是可以保存的
恳请大侠帮帮忙啊!!在线等
程序代码:
Dim str As New ADODB.Stream Dim Conn As New ADODB.Connection Dim rs As New ADODB.Recordset ... Private Sub Form_Load() Conn.Provider = "Microsoft.Jet.OLEDB.4.0" Conn.ConnectionString = "Data Source=" & App.Path & "\zxb.mdb" & " ;Jet OLEDB:Database password= coucongzi" ';Persist Security Info=False" Conn.Open rs.CursorLocation = adUseClient rs.Open "select * from hzb", Conn, adOpenDynamic, adLockPessimistic ... Private Sub save_Click() '保存数据 str.Open rs.AddNew If CommonDialog1.FileName <> "" Then Call ViewDatayt Else Call ViewDatamt End If rs.Update Form1.Refresh MsgBox "保存成功!", vbOKOnly, "温馨提示!" str.Close bj.Enabled = True xz.Enabled = True save.Enabled = False End Sub ... Private Sub ViewDatayt() '定义赋值函数 载入数据库 有图片 str.LoadFromFile CommonDialog1.FileName '载入图片 rs.Fields("面部交期") = Text2(0).Text rs.Fields("装饰交期") = Text2(1).Text rs.Fields("底部交期") = Text2(2).Text rs.Fields("包装交期") = Text2(3).Text rs.Fields("材料") = Text2(4).Text rs.Fields("补产材料") = Text2(5).Text rs.Fields("原因分析") = Text2(6).Text rs.Fields("外加工单位") = Text2(7).Text rs.Fields("印刷单位") = Text2(8).Text rs.Fields("备注") = Text2(9).Text rs.Fields("备注一") = Text2(10).Text rs.Fields("备注二") = Text2(11).Text rs.Fields("备注三") = Text2(12).Text rs.Fields("图片") = str.Read rs.Fields("编号") = Text7.Text End Sub ... Private Sub Command2_Click() On Error Resume Next Kill (App.Path + "\test1.jpg") CommonDialog1.DialogTitle = "加载图片" CommonDialog1.Filter = "所有图片文件|*.jpg" CommonDialog1.ShowOpen Image1.Picture = LoadPicture(CommonDialog1.FileName) End Sub
[ 本帖最后由 coucongzi 于 2014-3-5 11:49 编辑 ]