A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Wrong amount of arguments!



 
 
Thread Tools Display Modes
  #1  
Old March 13th, 2010, 06:19 AM posted to microsoft.public.access.reports
Bob Vance
external usenet poster
 
Posts: 726
Default Wrong amount of arguments!

What I want is tblInvoice.ClientDetail but if blank tblInvoice.HorseName but
if blank
funGetHorseName(tblInvoice.InvoiceID,tblInvoice.Ho rseID),tblInvoice.HorseName)

& "iif(tblInvoice.ClientDetail='',tblInvoice.HorseNa me='
',funGetHorseName(tblInvoice.InvoiceID,tblInvoice. HorseID),tblInvoice.HorseName)
AS ClientDetail," _

--
Thanks in advance for any help with this......Bob
MS Access 2007 accdb
Windows XP Home Edition Ver 5.1 Service Pack 3


  #2  
Old March 13th, 2010, 03:16 PM posted to microsoft.public.access.reports
Ken Snell
external usenet poster
 
Posts: 177
Default Wrong amount of arguments!

Not sure I'm following comletely correctly, but perhaps this is what you
seek:

IIf(Len(tblInvoice.ClientDetail & "") = 0, IIf(Len(tblInvoice.HorseName &
"") = 0, funGetHorseName(tblInvoice.InvoiceID, tblInvoice.HorseID),
tblInvoice.HorseName), tblInvoice.ClientDetail)

--

Ken Snell
http://www.accessmvp.com/KDSnell/


"Bob Vance" wrote in message
...
What I want is tblInvoice.ClientDetail but if blank tblInvoice.HorseName
but if blank
funGetHorseName(tblInvoice.InvoiceID,tblInvoice.Ho rseID),tblInvoice.HorseName)

& "iif(tblInvoice.ClientDetail='',tblInvoice.HorseNa me='
',funGetHorseName(tblInvoice.InvoiceID,tblInvoice. HorseID),tblInvoice.HorseName)
AS ClientDetail," _

--
Thanks in advance for any help with this......Bob
MS Access 2007 accdb
Windows XP Home Edition Ver 5.1 Service Pack 3




  #3  
Old March 13th, 2010, 09:37 PM posted to microsoft.public.access.reports
Bob Vance
external usenet poster
 
Posts: 726
Default Wrong amount of arguments!


"Ken Snell" wrote in message
...
Not sure I'm following comletely correctly, but perhaps this is what you
seek:

IIf(Len(tblInvoice.ClientDetail & "") = 0, IIf(Len(tblInvoice.HorseName &
"") = 0, funGetHorseName(tblInvoice.InvoiceID, tblInvoice.HorseID),
tblInvoice.HorseName), tblInvoice.ClientDetail)

--

Ken Snell
http://www.accessmvp.com/KDSnell/


Thanks Ken, How do I incorerate it into this string....Regards Bob

Private Sub Report_Open(Cancel As Integer)

Me.Caption = "Monthly Horse Invoice Report"

Dim strSQL As String

strSQL = "SELECT tblInvoice.InvoiceDate, tblInvoice.InvoiceNo," _
& "tblInvoice.OwnerName, tblInvoice.TotalAmount," _
& "tblInvoice.OwnerPercentAmount FROM tblInvoice WHERE" _
& " tblInvoice.OwnerID=Forms!frmMonthlyClientInvoice!c bHorseName.value" _
& " AND tblInvoice.InvoiceDate=" &
Format("Forms!frmMonthlyClientInvoice!tbDateFrom.v alue", "mm/dd/yyyy") _
& " AND tblInvoice.InvoiceDate=" &
Format("Forms!frmMonthlyClientInvoice!tbDateTo.val ue", "mm/dd/yyyy") & ";"
Report.RecordSource = strSQL


End Sub


  #4  
Old March 14th, 2010, 07:34 PM posted to microsoft.public.access.reports
Ken Snell
external usenet poster
 
Posts: 177
Default Wrong amount of arguments!

Sorry, I am not seeing anything in the VBA code where it appears logical for
the expression to be inserted? Could you provide more information? Is this
expression meant to replace one of the fields currently in your string? Or
to be a new field in the string?

--

Ken Snell
http://www.accessmvp.com/KDSnell/


"Bob Vance" wrote in message
...

"Ken Snell" wrote in message
...
Not sure I'm following comletely correctly, but perhaps this is what you
seek:

IIf(Len(tblInvoice.ClientDetail & "") = 0, IIf(Len(tblInvoice.HorseName &
"") = 0, funGetHorseName(tblInvoice.InvoiceID, tblInvoice.HorseID),
tblInvoice.HorseName), tblInvoice.ClientDetail)

--

Ken Snell
http://www.accessmvp.com/KDSnell/


Thanks Ken, How do I incorerate it into this string....Regards Bob

Private Sub Report_Open(Cancel As Integer)

Me.Caption = "Monthly Horse Invoice Report"

Dim strSQL As String

strSQL = "SELECT tblInvoice.InvoiceDate, tblInvoice.InvoiceNo," _
& "tblInvoice.OwnerName, tblInvoice.TotalAmount," _
& "tblInvoice.OwnerPercentAmount FROM tblInvoice WHERE" _
& " tblInvoice.OwnerID=Forms!frmMonthlyClientInvoice!c bHorseName.value" _
& " AND tblInvoice.InvoiceDate=" &
Format("Forms!frmMonthlyClientInvoice!tbDateFrom.v alue", "mm/dd/yyyy") _
& " AND tblInvoice.InvoiceDate=" &
Format("Forms!frmMonthlyClientInvoice!tbDateTo.val ue", "mm/dd/yyyy") & ";"
Report.RecordSource = strSQL


End Sub




  #5  
Old March 17th, 2010, 02:33 AM posted to microsoft.public.access.reports
Ken Snell
external usenet poster
 
Posts: 177
Default Wrong amount of arguments!

You're welcome. Glad you were able to "fix" those last few items!
--

Ken Snell
http://www.accessmvp.com/KDSnell/


"Bob Vance" wrote in message
...
Got it
changed AS ClientDetailField" to AS ClientDetail"
Brilliant thanks Bob

"Bob Vance" wrote in message
...
Thanks Ken got it going now, just gatting a parameter error on
ClientDetail
Will try and work it out
Regards Bob

"Bob Vance" wrote in message
...
Ken i am getting a error ' expect end of statement on - ")& "
4 of the last six symbols
Thanks bob
"Ken Snell" wrote in message
...
Try this:

strSQL = "SELECT tblInvoice.InvoiceDate, tblInvoice.InvoiceNo," _
& "tblInvoice.OwnerName, tblInvoice.TotalAmount," _
& "tblInvoice.OwnerPercentAmount, " & _
"IIf(Len(tblInvoice.ClientDetail & """") = 0, " & _
"IIf(Len(tblInvoice.HorseName & " & _
""""") = 0, funGetHorseName(tblInvoice.InvoiceID, tblInvoice.HorseID),
" & _
"tblInvoice.HorseName), tblInvoice.ClientDetail) AS ClientDetailField"
& _
" FROM tblInvoice WHERE" _
& "
tblInvoice.OwnerID=Forms!frmMonthlyClientInvoice!c bClientName.value" _
& " AND tblInvoice.InvoiceDate=" & _
Format(Forms!frmMonthlyClientInvoice!tbDateFrom.va lue, _
"\#mm\/dd\/yyyy\#") _
& " AND tblInvoice.InvoiceDate=" & _
Format(Forms!frmMonthlyClientInvoice!tbDateTo.valu e, _
"\#mm\/dd\/yyyy\#") ") & ";"

--

Ken Snell
http://www.accessmvp.com/KDSnell/



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.