請教一下問題
Set mObjrs = NothingmObjrs.Open "
select T01,T02,T03,kfname1,yjprice1,maxamt1,kfname,
yjprice2,maxamt2,cb,remark,auditing from t_yjmax where T01='" & Text11.Text & "' AND T02='" & Text10.Text & "'", Gobjcn, adOpenKeyset, adLockOptimistic
name = mObjrs("auditing") --這里錯了因為沒有資料
If IsNull(mObjrs.Fields("auditing")) <> Empty Or mObjrs.Fields("auditing") <> Null Or mObjrs.Fields("auditing") <> "" Then
Set mObjrs = Nothing
mObjrs.CursorLocation = adUseClient
mObjrs.Open "select T01,T02,T03,kfname1,yjprice1,maxamt1,kfname,yjprice2,maxamt2,cb,remark from t_yjmax where LEFT(T02,8) between '" & Format(DTP1.Value, "yyyymmdd") & "' AND '" & Format(DTP2.Value, "yyyymmdd") & "' AND T01='" & Text11.Text & "' AND T02='" & Text10.Text & "'", Gobjcn, adOpenKeyset, adLockOptimistic
Else
Gobjcn.Execute "delete from t_yjmax where T02='" & Text10.Text & "' and T01='" & Text11.Text & "' and LEFT(T02,8) BETWEEN '" & Format(DTP1.Value, "yyyymmdd") & "' AND '" & Format(DTP2.Value, "yyyymmdd") & "'"
strquery = "insert into t_yjmax select stime1='" & Strime1 & "',T01,T02,T03,kfname1='joe',yjprice1=0,maxamt1=0,TC008,kfname='mark',yjprice2=0,maxamt2=0,cb=0,remark='',auditing='',auddate=" & Frmauditing.DTPicker1.Value & " from t_ta LEFT JOIN t_tb ON T01=Tb01 AND T02=Tb02 where T02='" & Text10.Text & "' AND T01='" & Text11.Text & "' AND LEFT (T02,8) BETWEEN '" & Format(DTP1.Value, "YYYYMMDD") & "' AND '" & Format(DTP2.Value, "YYYYMMDD") & "' "
Gobjcn.Execute strquery
Set mObjrs = Nothing
mObjrs.CursorLocation = adUseClient
mObjrs.Open "select T01,T02,T03,kfname1,yjprice1,maxamt1,kfname,yjprice2,maxamt2,cb,remark from t_yjmax where LEFT(T02,8) between '" & Format(DTP1.Value, "yyyymmdd") & "' AND '" & Format(DTP2.Value, "yyyymmdd") & "' AND T01='" & Text11.Text & "' AND T02='" & Text10.Text & "' and auditing='" & "'", Gobjcn, adOpenKeyset, adLockOptimistic
End If 大家幫一忙我這個是要從另外兩個表插到一個表,但是又有審核還不能重復
如果打這張表里沒有的就出錯,因為還沒有插入這張表,還不能把審核給刪了,
幫下忙