473,902 Members | 6,056 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error 3071: Expression too complex

Knut Ole
70 New Member
Hi,

I had a beautifully working code, but it's now 3071, and I don't know what have changed. I get 3071 on line 214, but I suspect that's not where the problem lies?

I'm looking and looking, and can't seem to find what could create this error...

Expand|Select|Wrap|Line Numbers
  1. 'draw: bookings
  2.     '**************
  3.  
  4.     Do Until RecSetBookings.EOF
  5.  
  6.         'finding variables
  7.         '*****************
  8.         q = RecSetBookings("RoomID").Value - 1
  9.         vOffset = 420 * q
  10.         arTop = vOffset + 40
  11.  
  12.  
  13.         slBeg = RecSetBookings.Fields("SlotBegin").Value
  14.         slEnd = RecSetBookings.Fields("SlotEnd").Value
  15.  
  16.             bolDrawTail = True
  17.             bolDrawHead = True
  18.             bolDrawBody = True
  19.             bolDrawLabel = True
  20.             bolDrawSmall = False
  21.  
  22.         leftpos = (slBeg - dstart) * 1217 + 730
  23.         'MsgBox leftpos
  24.             If leftpos < 720 Then
  25.                 bolDrawTail = False
  26.                 leftpos = 720
  27.                 leftposbox = 730
  28.                 wdthBox = (((slEnd - dstart) * 1217) - 370)
  29.                 If wdthBox < 0 Then wdthBox = 0
  30.                 If wdthBox > 0 Then wdthBox = ((slEnd - dstart) * 1217) - 180
  31.                 leftposhead = leftpos + wdthBox
  32.                 MsgBox leftposhead & ", " & wdthBox
  33.                 If leftposhead < 720 Then leftposhead = 730 + wdthBox
  34.  
  35.             Else
  36.                 bolDrawTail = True
  37.                 leftposbox = leftpos + 180
  38.                 wdthBox = (((slEnd - slBeg) * 1217) - 370)
  39.                 If wdthBox < 0 Then wdthBox = 0
  40.                 leftposhead = leftpos + ((slEnd - slBeg) * 1217) - 190
  41.             End If
  42.  
  43.         rcBookID = RecSetBookings.Fields("Bookings.ID").Value
  44.         bConf = RecSetBookings.Fields("Confirmed").Value
  45.         chinDate = RecSetBookings.Fields("CheckInDate").Value
  46.         choutDate = RecSetBookings.Fields("CheckOutDate").Value
  47.         bChkIn = RecSetBookings.Fields("CheckedIn").Value
  48.         bChkOut = RecSetBookings.Fields("CheckedOut").Value
  49.  
  50.        ' MsgBox slBeg & ", " & dstart
  51.  
  52.         If bChkIn = True And bChkOut = False Then colorArrow = 1                                'green
  53.         If chinDate = Date And bChkIn = False Then colorArrow = 2                               'green shade
  54.         If chinDate > Date And bConf = True Then colorArrow = 3                                 'yellow
  55.         If chinDate > Date And bConf = False Then colorArrow = 4                                'yellow shade
  56.         If choutDate = Date And bChkOut = False Or choutDate < Date Then colorArrow = 5         'red
  57.         If bChkOut = True Then colorArrow = 6                                                   'grey
  58.         '+ black for out of order
  59.  
  60.  
  61.         Select Case colorArrow
  62.             Case 1 'green
  63.                 tailImage = imgGreenArrowTail
  64.                 headImage = imgGreenArrowHead
  65.                 bodyImage = imgGreenBox
  66.                 lblForeColor = RGB(255, 255, 255)
  67.                 smallImage = imgGreenArrowSmall
  68.             Case 2 'green shaded
  69.                 tailImage = imgGreenArrowTailShade
  70.                 headImage = imgGreenArrowHeadShade
  71.                 bodyImage = imgGreenBoxShade
  72.                 lblForeColor = RGB(255, 255, 255)
  73.                 smallImage = imgGreenArrowSmallShaded
  74.             Case 3 'yellow
  75.                 tailImage = imgYellowArrowTail
  76.                 headImage = imgYellowArrowHead
  77.                 bodyImage = imgYellowBox
  78.                 lblForeColor = RGB(255, 255, 255)
  79.                 smallImage = imgYellowArrowSmall
  80.             Case 4 'yellow shaded
  81.                 tailImage = imgYellowArrowTailShade
  82.                 headImage = imgYellowArrowHeadShade
  83.                 bodyImage = imgYellowBoxShade
  84.                 lblForeColor = RGB(0, 0, 0)
  85.                 smallImage = imgYellowArrowSmallShaded
  86.             Case 5 'red
  87.                 tailImage = imgRedArrowTail
  88.                 headImage = imgRedArrowHead
  89.                 bodyImage = imgRedBox
  90.                 lblForeColor = RGB(255, 255, 255)
  91.                 smallImage = imgRedArrowSmall
  92.             Case 6 'grey
  93.                 tailImage = imgGreyArrowTail
  94.                 headImage = imgGreyArrowHead
  95.                 bodyImage = imgGreyBox
  96.                 lblForeColor = RGB(255, 255, 255)
  97.                 smallImage = imgGreyArrowSmall
  98.             Case 7 'black
  99.  
  100.         End Select
  101.  
  102.         If IsNull(slEnd) Then MsgBox "slEnd is null!?"
  103.         If IsNull(slBeg) Then MsgBox "slBeg is null!?"
  104.  
  105.         If slEnd - slBeg < 0.33 Then
  106.             MsgBox "< 8 hours"
  107.             tailImage = shortImage
  108.             bolDrawTail = False
  109.             bolDrawHead = False
  110.             bolDrawBody = False
  111.             bolDrawLabel = False
  112.             bolDrawSmall = True
  113.         End If
  114.  
  115.  
  116.         'draw: small arrow
  117.         '**********
  118.         If bolDrawSmall = True Then
  119.         Set cImg1 = CreateControl(strForms, acImage)
  120.          With cImg1
  121.              .BackStyle = 0
  122.              'msgWidth = (slEnd - slBeg) * 1217
  123.              'MsgBox "msgW=" & msgWidth & ", slEnd=" & slEnd & ", slBeg=" & slBeg & ", ID=" & rcBookID
  124.              .Width = (slEnd - slBeg) * 1217
  125.              .Height = 360
  126.              .Left = leftpos
  127.              .Top = arTop
  128.              .ControlTipText = rcBookID
  129.              .OnClick = ""
  130.              .Picture = smallImage
  131.              .SizeMode = acOLESizeStretch
  132.             '.PictureAlignment = 0
  133.          End With
  134.         End If
  135.  
  136.         'draw: tail
  137.         '**********
  138.         If bolDrawTail = True Then
  139.         Set cImg1 = CreateControl(strForms, acImage)
  140.          With cImg1
  141.              .BackStyle = 0
  142.              .Width = 432
  143.              .SizeMode = 0
  144.              .Height = 360
  145.              .Left = leftpos
  146.              .Top = arTop
  147.              .ControlTipText = rcBookID
  148.              .OnClick = ""
  149.              .Picture = tailImage
  150.              .SizeMode = acOLESizeZoom
  151.              .PictureAlignment = 0
  152.          End With
  153.         End If
  154.  
  155.         'draw: head
  156.         '**********
  157.         If bolDrawHead = True Then
  158.         Set cImg2 = CreateControl(strForms, acImage)
  159.             With cImg2
  160.                 .BackStyle = 0
  161.                 .Width = 400
  162.                 .Height = 360
  163.                 .SizeMode = 0
  164.                 .ControlTipText = rcBookID
  165.                 .Left = leftposhead
  166.                 '.Left = leftPos + 300
  167.                 .Top = arTop
  168.                 .Picture = headImage
  169.                 .SizeMode = acOLESizeZoom
  170.                 .PictureAlignment = 0
  171.                 .BorderStyle = 0
  172.             End With
  173.         End If
  174.  
  175.         'draw: body
  176.         '***************
  177.         If bolDrawBody = True Then
  178.         Set cImg3 = CreateControl(strForms, acImage)
  179.            With cImg3
  180.                 .BackStyle = 0
  181.                 .Width = wdthBox
  182.                 .Height = 360
  183.                 .SizeMode = 0
  184.                 .ControlTipText = rcBookID
  185.                 .Left = leftposbox
  186.                 '.Left = leftPos + 300
  187.                 .Top = arTop
  188.                 .Picture = bodyImage
  189.             End With
  190.         End If
  191.  
  192.         'draw: label
  193.         '**********
  194.         If bolDrawLabel = True Then
  195.         Set cLbl1 = CreateControl(strForms, acLabel)
  196.            With cLbl1
  197.                .Visible = True
  198.                .BackColor = RGB(255, 194, 14)
  199.                .ForeColor = lblForeColor
  200.                .FontWeight = 900
  201.                .TopMargin = 34
  202.                .TextAlign = 2
  203.                .BackStyle = 0
  204.                .FontWeight = 900
  205.                .Top = arTop + 10
  206.                .Height = 330
  207.                .Left = leftposbox
  208.                .Width = wdthBox
  209.                '.Width = 200
  210.                .Caption = rcBookID
  211.            End With
  212.         End If
  213.  
  214.         RecSetBookings.MoveNext                                         'moving to next booking
  215.  
  216.     Loop
  217.  
I can post the whole module if needed. Thank you very much!
Apr 28 '11
10 11634
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
As I mentioned earlier, im not too experienced in the different types of recordsets but here goes anyway:

I believe that the dbOpensnapshot might only open a section of the recordset. Thus the problem doesn't occur until you use .MoveNext to move to a "yet unloaded" section of the recordset, and while access loads the next section, it runs into empty fields while performing the query, and thus throws the error at that point in the code (the .MoveNext).

If you try to change the recordset to a dbopendynaset, I suspect that it should throw the error when you first open the recordset.

Thats kinda the best sense I can make of the situation at present, since cdbl(Null) will throw an error 94 (Invalid use of Null). I know thats not the error your seeing, but maybe thats still the underlying problem.


On another note, I dont think you need to use the cdbl function.

While you can use and mix SQL and vba functions you should know that there will be a performance hit when you mix the two. A pure SQL (with no VBA calls) will run significantly faster.
Apr 29 '11 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1784
by: der | last post by:
The expression isn't a = 1 - (1-), but: a = -1 - (1)
2
20181
by: deko | last post by:
SELECT Nz(Min(),#1/1/1000#) AS NextAppt, Appt_ID FROM tblAppointments WHERE Entity_ID=!! AND ApptDate>=Date() If I do not include Appt_ID, it works fine. But I need the ID so I can join other queries to this one. My guess is this is an elementary error... Thanks in advance.
4
25256
by: Saso Zagoranski | last post by:
Hi! I have created an SqlCommand object and I have set some parameters to it... One of the parameters is of the DateTime type; here is the code: sqlCommand.Parameters.Value = DateTime.Parse(this.DateTextBox.Text); sqlCommand.ExecuteNonReader(); I get the error:
1
4376
by: parveen.beniwal | last post by:
hi all i am having the following line of code in my mak file. !IF "$(CFG)" == "" CFG=DesktopCommon - Win32 Release !MESSAGE No configuration specified. Defaulting to DesktopCommon - Win32 Release.
2
12676
by: Hulikal | last post by:
Hi, I using the following query select dateadd(s, 1185255439727, '01-01-1970 05:30:00') on MSSQL 2005. I get the error Arithmetic overflow error converting expression to data type int. If I use the query
1
4070
by: ashiremath | last post by:
Hi All Below the code giving me the error is Constant expression is required. Please help me for this program. Private Sub Send_InputChoice() Dim Input_String As Integer Const n As Integer = chs n = chs
1
2908
by: opcs | last post by:
here is my complete code, can any one help me why does this error occurs and how to resolve it. also, error is at the line "list.hdr =(list *) malloc(sizeof(struct SkipList));" is the size allocation here is correct or it should be diffrent. code: #include <stdio.h> #include <stdlib.h> #define compLT(a,b) (a < b) #define compEQ(a,b) (a == b)
2
21932
by: lordhoban | last post by:
My program was running fine under visual studio, but I moved it over to Linux, and have run into one problem I have no idea how to fix. error: expected expression before 'int' (all the following lines cause the error. Obviously it is what I'm doing with the INT that is the problem); CEnts = NetPay - int(NetPay); numHuns = int(NetPay)/100; numHuns = int(NetPay)/1000;
5
1914
by: Adrian Tache | last post by:
I'm having an issue with a query search for invoices where the due date of the invoices searched is provided through a combo box in a form the combo box has the following code: DoCmd.OpenQuery "Invoice by Due Date" Me.Combo0 = "" it basically runs the query which has the condition below which equates invoice due date to: !! to which i get a 3071 expression too complex error. same error if I run the query directly. ran the same...
0
9997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11279
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10870
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5893
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4725
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4306
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3323
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.