您的位置:程序门 -> vb -> vba



vb 错误424 请高手帮忙


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


vb 错误424 请高手帮忙
发表于:2008-02-27 08:08:48 楼主
以下是程序

option   explicit

public   adocnn   as   new   adodb.connection
public   rs,   rs2   as   new   adodb.recordset

public   sub   connection()
if   adocnn.state   =   adstateopen   then
adocnn.close
end   if
adocnn.provider   =   "microsoft.jet.oledb.4.0"
adocnn.open   app.path   &   "\瓶盖.mdb"
end   sub

private   sub   cmdcancel_click()
frmmain.show
unload   me
end   sub

private   sub   cmdok_click()
dim   strsql   as   string
dim   temp   as   integer


if   chksale.value   =   1   then
strsql   =   "select   *   from   出售"
call   connection
rs.cursorlocation   =   aduseclient
rs.open   strsql,   adocnn,   adopendynamic,   adlockoptimistic
rs.addnew
rs.fields(1)   =   textmarket.text
rs.fields(2)   =   textnombreg.text
rs.fields(3)   =   textnombrep.text
rs.addnew
end   if

if   chkrecede   =   1   then
strsql   =   "select   *   from   回收"
call   connection
rs.cursorlocation   =   aduseclient
rs.open   strsql,   adocnn,   adopendynamic,   adlockoptimistic
rs.addnew
rs.fields(1)   =   textmarket.text
rs.fields(2)   =   textnombreg.text
rs.fields(3)   =   textnombrep.text
rs.addnew
end   if

temp   =   msgbox("是否继续输入?",   vbyesno)
if   temp   =   6   then
textmarket.text   =   ""
textcode.text   =   ""
textnombreg.text   =   ""
textnombrep.text   =   ""
else
frmmain.show
unload   me
end   if
end   sub

private   sub   datagrid1_click()
textmarket.text   =   rs2.fields(0)
end   sub

private   sub   textcode_keypress(keyascii   as   integer)
if   keyascii   =   13   then
dim   strsql3,   temp   as   string
temp   =   textcode.text
strsql3   =   "select   *   from   商店   where   商店代码   =   '"   +   cstr(temp)   +   "'"
call   connection
rs2.cursorlocation   =   aduseclient
rs2.open   strsql3,   adocnn,   adopendynamic,   adlockoptimistic
set   datagrid1.datasource   =   rs2
end   if
end   sub

private   sub   textnombreg_keypress(keyascii   as   integer)
if   keyascii   =   13   then
call   cmdok_click
end   if
end   sub

private   sub   textnombrep_keypress(keyascii   as   integer)
if   keyascii   =   13   then
call   cmdok_click
end   if
end   sub

发表于:2008-02-27 08:27:531楼 得分:0
帮顶
发表于:2008-02-27 09:53:122楼 得分:0
多谢
发表于:2008-02-27 10:18:213楼 得分:0
你试下,把连接符号"+"改成"&",我上次也是找个半天,结果问题就出在这里.
try,....
发表于:2008-02-27 10:44:214楼 得分:0
谢谢,我已经改过来了


快速检索

最新资讯
热门点击