INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Access Query is too complex to run - error message

Access Query is too complex to run - error message

(OP)
I have a query in Access Database and when I try to run it, I get an error message "query is too complex to run." Runtime error 3360." The problem is with one formula / programming logic, see below:

Previously the formula was the below - and it worked.

IIf([BegTaxBasis]=0 And [Contribution]+[Distribution]=0,0,IIf([BegTaxBasis]=0 And [TaxIncSubTotal]=0,-[Distribution],IIf([Distribution]=0,0,IIf([TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse]<[Distribution],-[Distribution],0))))

Then I updated it to, see below:

IIf([BegTaxBasis]=0 And [Contribution]+[Distribution]=0,0,IIf([BegTaxBasis]=0 And [TaxIncSubTotal]=0,-[Distribution],IIf([Distribution]=0,0,IIf([TBBLL]>0,0,IIf([TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse]<[Distribution],-[Distribution],IIf([TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse]>[Distribution] And [TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse]<0 And [TaxIncSubTotal]<0,[TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse]-[TaxIncSubTotal],[TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse])))))

And now the query wont run, any help is much appreciated, thanks!

RE: Access Query is too complex to run - error message

Tia,
I haven't tried running this so it still may not work, but I simplified it a little and added () to clarify.

IIf(([BegTaxBasis]=0 And [Contribution]+[Distribution]=0) or ([BegTaxBasis]=0 And [Contribution]+[Distribution]=0) Or [Distribution]=0 Or [TBBLL]>0,0,IIf([TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse]<[Distribution],-[Distribution],IIf(([TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse]>[Distribution] And [TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse]<0 And [TaxIncSubTotal]<0),[TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse]-[TaxIncSubTotal],[TBBLL]+[Recourse]+[QualifiedNonrecourse]+[NonRecourse])))

I hope that helps.
Laurie

RE: Access Query is too complex to run - error message

Create a user-defined function that accepts the various fields and returns the calculated value. Add comments and save it in a module named modBusinessCalcs.

Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016

RE: Access Query is too complex to run - error message

(OP)
I began to convert it to VBA:

Public Function GetVal(BegTaxBasis As Variant, Contribution As Variant, Distribution As Variant, TaxIncSubTotal As Variant, TBBLL As Variant, Recourse As Variant, QualifiedNonRecourse As Variant, NonRecourse As Variant) As Long

Dim TRQN As Long
TQRN = TBBLL + Recourse + QualifiedNonRecourse + NonRecourse
If BegTaxBasis = 0 And TaxIncSubTotal = 0 Or TRQN < Distribution Then
GetVal = -Distribution
ElseIf (TRQN > Distribution And TRQN < 0) And TaxIncSub < 0 Then
GetVal = TRQN - TaxIncSub
Else
GetVal = TRQN
End If
End Function

However, now am getting "enter parameter value" message, when I run the query and it doesn't calculate.

RE: Access Query is too complex to run - error message

Tia77,
Is this the same expression that MajP already provided a solution?

Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close