Hi,

I'm trying to automate taking certain data from an AS400 database and inserting it into Access.

I keep getting  this error:

[Blanket Agreement][Main](Step 5) ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

I dont know what it means or how to resolve it.

I've linked my code below. Please note due to company rules I've had to remove any sensitive data such as the connection string.

<AMDATABASE SESSION="DatabaseSession1" CONNECTION="" />
<AMDATABASE ACTIVITY="sql_query" SESSION="DatabaseSession1" RESULTDATASET="dSQL">select distinct
a.UACUNO as CustNo,
b.UBITNO as ItemNo,
a.UAIVDT as InvDate,
b.UBIVQT as InvQty,
b.UBORNO as OrdNo,
b.UBCUOR as CustOrdNo
from mvxcdta.ODHEAD a
left join mvxcdta.ODLINE b on A.UAORNO = B.UBORNO 
where UADIVI = 'GB0' and UAYEA4 = '2022' and UBPOSX = '0' and UACUNO = 'xxxx'
</AMDATABASE>
<AMDATABASE SESSION="DatabaseSession3" CONNECTIONTYPE="connection_string" CONNECTION="Provider=MSDASQL.1;Persist Security Info=False;Extended Properties=&quot;DSN=MS Access Database;DBQ=\\\Blanket Agreements.accdb;DefaultDir=C:\Users\Administrator\AppData\Local\Temp;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=myuserID;&quot;" />
<AMLOOP ACTIVITY="dataset" DATASET="dSQL" FROM="1" TO="%dSQL.TotalRows%" />
<AMDATABASE ACTIVITY="sql_query" SESSION="DatabaseSession3" RESULTDATASET="ds_Access">INSERT INTO Tbl_DataImport (CustNo, ItemNo, InvDate, InvQty, OrdNo, CustOrdNo)
Values (%dSQL.CUSTNO%,%dSQL.ITEMNO%,%dSQL.INVDATE%,%dSQL.INVQTY%,%dSQL.ORDNO%,%dSQL.CUSTORDNO%);</AMDATABASE>
<AMLOOP ACTIVITY="end" />

Has anyone encountered this error before and do you know what I need to do?

Many Thanks