jadams0173
Technical User
- Feb 18, 2005
- 1,210
I'm trying to run the query from VBA using Currentproject.Connection.Execute method and I get the error "No value given for one or more required parameters". Here is the query from code and a debug.print of the query.
Here is the debug.print
I think it is this
that is causing the problem. But if I use
it evaluates to 0 and not T or B since Val returns a Double.
I tried to have patience but it took to long!
-DW
Code:
sqlUpdate = "UPDATE " & TempTable & " SET " & TempTable & ".PRIMARYT = IIf([Forms]![FRMMAIN]![TB] ='T','" & Val([Forms]![FRMMAIN]![PrimLine]) & "','" & Val([Forms]![FRMMAIN]![PRIMARYT]) & "')," & TempTable & ".PRIMARYB = IIf([Forms]![FRMMAIN]![TB]='B','" & Val([Forms]![FRMMAIN]![PrimLine]) & "','" & Val([Forms]![FRMMAIN]![PRIMARYB]) & "') " _
& "WHERE (((" & TempTable & ".MO_NUMBER)='" & txtMO & "') AND ((" & TempTable & ".TB)<>'X'))"
'DoCmd.RunSQL sqlUpdate, 129
Debug.Print sqlUpdate
CurrentProject.Connection.Execute sqlUpdate, , 129
Here is the debug.print
Code:
UPDATE SCHEDULE SET SCHEDULE.PRIMARYT = IIf([Forms]![FRMMAIN]![TB] ='T','97','0'),SCHEDULE.PRIMARYB = IIf([Forms]![FRMMAIN]![TB]='B','97','0') WHERE (((SCHEDULE.MO_NUMBER)='123456') AND ((SCHEDULE.TB)<>'X'))
I think it is this
Code:
([Forms]![FRMMAIN]![TB]='B'
Code:
Val(([Forms]![FRMMAIN]![TB])='B'
I tried to have patience but it took to long!