MS Access currentdb.excute has different result than Docmd.RunSQL -


i use vba run insert ... select... sql query currentdb.execute command. however, have trouble result. there rows missing data.

the result correct when using docmd.runsql same sql, don't want warning message inserting data table.

i tried using select... currentdb.execute , print result on debug window. result correct, no missing data.

here's code:

strsql = strsql & "insert templineitems (orderno, positionno, partno, [description], planneddeliverydate, qty, unit, price, curr, txta, lineitemtext, discount, tax) " strsql = strsql & "select dbo_ttdsls041600.t_orno, dbo_ttdsls041600.t_pono, dbo_ttdsls041600.t_item, iif(dbo_ttipcs021600.t_dsca null,dbo_ttiitm001600.t_dsca,dbo_ttipcs021600.t_dsca) t_dsca, dbo_ttdsls041600.t_ddta, dbo_ttdsls041600.t_oqua, dbo_ttdsls041600.t_cups, dbo_ttdsls041600.t_pric, dbo_ttdsls040600.t_ccur, dbo_ttdsls041600.t_txta, null lineitemtext, dbo_ttdsls041600.t_disc_1, dbo_ttdsls041600.t_cvat " strsql = strsql & "from dbo_ttdsls040600 inner join ((dbo_ttipcs021600 right join dbo_ttdsls041600 on (dbo_ttipcs021600.t_item = dbo_ttdsls041600.t_item) , (dbo_ttipcs021600.t_cprj = dbo_ttdsls041600.t_cprj)) left join dbo_ttiitm001600 on dbo_ttdsls041600.t_item = dbo_ttiitm001600.t_item) on dbo_ttdsls040600.t_orno = dbo_ttdsls041600.t_orno " strsql = strsql & "where (((dbo_ttdsls041600.t_orno)=" & me.txtsalesorderno.value & ") , ((dbo_ttdsls041600.t_pono)>0)) " strsql = strsql & "order dbo_ttdsls041600.t_pono;" 

the problem on

iif(dbo_ttipcs021600.t_dsca null,dbo_ttiitm001600.t_dsca,dbo_ttipcs021600.t_dsca) t_dsca 

i used isnull() function, , has same result using null

3/28/2017 update: tables linked tables sql server. created local tables based on subset data of linked ones, , there's no missing data @ all.

very odd. i've never had work sqlserver tables. use runsql , not warnings, turn them off , on.

docmd.setwarnings false docmd.runsql ... docmd.setwarnings true 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -