Minggu, 02 April 2017

[MS_AccessPros] Run time error '3061': too few parameters, expected 2

 

The following query works as a stand alone query, but results in the above error if run in vba:


stand alone:

SELECT [a/r open].*

FROM ([a/r open] LEFT JOIN Patient ON [a/r open].[patient id] = Patient.[patient id]) LEFT JOIN insurance ON [a/r open].insrcd = insurance.insrcd

WHERE (((([a/r open].[balance])<>0) AND [a/r open].private=true and ([a/r open].denied)<>-1) AND (([a/r open].[insrcd])= 'GHI') AND (([a/r open].[patient id]) Between 0 And 90128) AND (([a/r open].[sdate from]) Between #2/1/2015# And #3/28/2015#)) and (iif([Forms]![rebill]![transonly]=true,[a/r open].[cp]>9,[a/r open].[cp]<9) or iif([Forms]![rebill]![daycareonly]=true,[a/r open].[cp]<9,[a/r open].[cp]>9))

ORDER BY [a/r open].[invoice#];



VBA:


 "SELECT [a/r open].* " & _

"FROM ([a/r open] LEFT JOIN Patient ON [a/r open].[patient id] = Patient.[patient id]) LEFT JOIN insurance ON [a/r open].insrcd = insurance.insrcd " & _

"WHERE (((([a/r open].[balance])<>0) AND [a/r open].private=true and ([a/r open].denied)<>" & [Forms]![rebill]![rebillall] & ") AND (([a/r open].[insrcd])= '" & [Forms]![rebill]![insr] & "') AND (([a/r open].[patient id]) Between " & [Forms]![rebill]![ln from] & " And " & [Forms]![rebill]![ln to] & ") AND (([a/r open].[sdate from]) Between #" & [Forms]![rebill]![pid from] & "# And #" & [Forms]![rebill]![pid to] & "#)) and (iif([Forms]![rebill]![transonly]=true,[a/r open].[cp]>9,[a/r open].[cp]<9) or iif([Forms]![rebill]![daycareonly]=true,[a/r open].[cp]<9,[a/r open].[cp]>9)) " & _

"ORDER BY [a/r open].[invoice#];"

   


Since I added:


'and (iif([Forms]![rebill]![transonly]=true,[a/r open].[cp]>9,[a/r open].[cp]<9) or iif([Forms]![rebill]![daycareonly]=true,[a/r open].[cp]<9,[a/r open].[cp]>9))' 


to the  VBA query it give me the error 3061, before than it was fine


I created the stand alone query by using print.debug and copy paste and found that it works fine.


I have tried google,  but can not figure it out.


As always your help is greatly appreciated.


Thanks


Sarah

__._,_.___

Posted by: sarahk@schemesoftware.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar