Minggu, 27 Oktober 2024

Re: [MSAccessProfessionals] Calculate overnight electricity consumption

Hi Duane,
Thank you so much for your help. It works perfectly as shown in the output below.
 
ActivityDate Activity Residents StartTime FinishTime InitialReading FinalReading Consumption OverNight
22/10/2024 Normal + cook 2 06:00 20:00 322.87 307.28 15.59 6.55
23/10/2024 Normal + laundry 2 06:00 20:00 300.04 284.04 16.00 7.24
24/10/2024 Normal + cook + pump 2 06:00 20:00 274.00 255.30 18.70 10.04
25/10/2024 Normal 2 06:00 20:00 249.38 234.38 15.00 5.92
26/10/2024 Normal + pump 2 06:00 20:00 228.42 211.41 17.01 5.96
_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#116655) | Reply to Group | Reply to Sender | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [sugeng.panjalu.access@blogger.com]

_._,_._,_

Sabtu, 26 Oktober 2024

Re: [MSAccessProfessionals] Calculate overnight electricity consumption

It looks like readings decrease through the day. Does this work for you? I changed column names to remove spaces and made up a table name.

SELECT ElectricityConsumption.ActivityDate, ElectricityConsumption.Activity, ElectricityConsumption.Residents,
 ElectricityConsumption.StartTime, ElectricityConsumption.FinishTime, ElectricityConsumption.InitialReading,
 ElectricityConsumption.FinalReading, ElectricityConsumption.Consumption,
(SELECT FinalReading FROM ElectricityConsumption C
  WHERE ElectricityConsumption.ActivityDate = C.ActivityDate +1)-[InitialReading] AS OverNight
FROM ElectricityConsumption;

Duane

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of asanteza@gmail.com <asanteza@gmail.com>
Sent: Friday, October 25, 2024 11:33 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: [MSAccessProfessionals] Calculate overnight electricity consumption
 
Hi Everyone,
I am trying to keep a database of my prepaid electricity consumption in MS Access 2019 version. As the table shows, I am able to calculate the daily usage from the initial and final readings of my meter. However, I am struggling to figure out the formula for Overnight usage (Final reading of previous day minus Initial reading of current day).
 
Activity date Activity Residents Start time Finish time Initial reading Final reading Consumption Overnight
21/10/2024 Normal + laundry 2 06:00 20:00 348.20 329.42 18.78  
22/10/2024 Normal + cook 2 06:00 20:00 322.87 307.28 15.59  
23/10/2024 Normal + laundry 2 06:00 20:00 300.04 284.04 16.00  
24/10/2024 Normal + cook + pump 2 06:00 20:00 274.00 255.30 18.70  
25/10/2024 Normal 2 06:00 20:00 249.38 234.38 15.00  

Jumat, 25 Oktober 2024

[MSAccessProfessionals] Calculate overnight electricity consumption

Hi Everyone,
I am trying to keep a database of my prepaid electricity consumption in MS Access 2019 version. As the table shows, I am able to calculate the daily usage from the initial and final readings of my meter. However, I am struggling to figure out the formula for Overnight usage (Final reading of previous day minus Initial reading of current day).
 
Activity date Activity Residents Start time Finish time Initial reading Final reading Consumption Overnight
21/10/2024 Normal + laundry 2 06:00 20:00 348.20 329.42 18.78  
22/10/2024 Normal + cook 2 06:00 20:00 322.87 307.28 15.59  
23/10/2024 Normal + laundry 2 06:00 20:00 300.04 284.04 16.00  
24/10/2024 Normal + cook + pump 2 06:00 20:00 274.00 255.30 18.70  
25/10/2024 Normal 2 06:00 20:00 249.38 234.38 15.00  
_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#116653) | Reply to Group | Reply to Sender | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [sugeng.panjalu.access@blogger.com]

_._,_._,_

Kamis, 10 Oktober 2024

Re: [MSAccessProfessionals] Invalid Procedure Call error

hi Mark, good suggestion about using NZ. As a general rule, that's good, However, in this case, LEN and LEFT functions don't return numeric values if argument being tested is null.

I disagree about using the term "NULL values" (because one means NOT the other).

Jim, expressions to try depending on which result is desired in this specific case, since my response was cut:

===========================

1. show whatever is there if length of Paragraph2 < 554

MemoWithDate: iif( Len(tblMaxCompensatoryMemo.Paragraph2 & "") > 554, Left([tblMaxCompensatoryMemo].[Paragraph2] & "", Len([tblMaxCompensatoryMemo].[Paragraph2] & "")-554, tblMaxCompensatoryMemo.Paragraph2)

2. show nothing if length of Paragraph2 < 554

MemoWithDate: iif( Len( tblMaxCompensatoryMemo.Paragraph2 & "") > 554, Left([tblMaxCompensatoryMemo].[Paragraph2] & "", Len([tblMaxCompensatoryMemo].[Paragraph2] & "")-554, "")


===========================

while the data may be Null, "this page left intentionally blank" is Not

if a field doesn't have a value, it is Null meaning NO VALUE. Some variable types can have other descriptors like Empty.

NZ doesn't work if displaying a field where there isn't a record, so sometimes I use the 'old' & "" trick -- it always works. However, I do use NZ a lot! IIF evaluates both result expressions, not just the one that gets used, and if LEN and LEFT are in there, they need to be fed strings not nulls to avoid errors. That's when I might use & ""

As far as knowing if data is missing, having nothing there is a good clue -- and easier to see than a message, imo

kind regards,

crystal


On 10/10/2024 3:21 PM, Mark Burns via groups.io wrote:
Crystal,
 
That's a great point about handling NULL values, but I interpret the words "Null value" a little differently than you may.
 
All:
(for general discussion purposes) What NULL means in your database:
It COULD mean literally anything. It specifically means Nothing.

What I mean by that is this: have you ever read a book or document and come across a blank page with the words "this page left intentionally blank" on it? That is ONE of the possible semantic meanings for a NULL in your database data. It also CAN mean: "no entry yet exists for this value", "the value here was deleted", "this value is undefined or uninitialized", amongst other semantic meanings that can be applied to the presence of a NULL value in your data.
It's only truly inarguable MEANING of a NULL value is: "there is no data here"

Now as to how we developers THINK about and prepare to handle NULLs (especially unexpected NULLs), well, there are several schools of thought.
One is that it is simple to append an empty string everywhere that unexpected NULLs can be encountered (which is what Crystal did) and thereby eliminate any errors arising from unexpected NULL values in your data, preserving the effectiveness of your query expressions (and related code).
Another is that while that IS simple, it can also obfuscatory.
What if it was crucial to know when a null value unexpectedly arose? Using the ' & "" ' method can effectively obfuscate those cases from being discovered or handled appropriately (to fix the missing data, say).
 
For that reason, I'm generally more in favor of explicitly handling nulls by using NZ() functions within any expression where NULL is a tripping hazard of significance. For example, using an expression like NZ([tblMaxCompensatoryMemo].[Paragraph2], "*** Missing Paragraph 2 data! ***") would achieve the same expression-safety result, but it would add a textual alert to point out the missing data.

Is this always necessary? No. Is it perhaps the better coding habit to use than ' & "" '? I will leave that for you to decide.
 
On 10/10/2024 3:57 PM EDT Mark Burns via groups.io <mburns_08109=comcast.net@groups.io> wrote:
 
 
Jim,  Yup, that'd do it...the solution, if you want to keep doing that 554 character trimming, would be to wrap that expression in an iif() function.
(Warning: "air code" follows)
MemoWithDate: iif(Len([tblMaxCompensatoryMemo].[Paragraph2]) > 554, Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554), [tblMaxCompensatoryMemo].[Paragraph2])
 
 
On 10/10/2024 11:52 AM EDT Jim Wagner <josephwagner2@outlook.com> wrote:
 
 
Duane,
242 characters with spaces
 
Jim Wagner
 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent: Thursday, October 10, 2024 8:50 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 
Thank You Duane. I will look
 
Jim Wagner
 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Duane Hookom <duanehookom@hotmail.com>
Sent: Thursday, October 10, 2024 7:26 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 
I would first look at the number of characters in Paragraph2 to make sure it's more than 554 characters.
 
Duane
 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent: Thursday, October 10, 2024 8:40 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: [MSAccessProfessionals] Invalid Procedure Call error
 
Hello All,
 
Yesterday I started to get an error message for "Invalid Procedure call" when I tried to open a report. This report has been running for years with no issues. This morning after several hours, I deleted from the query this line 
 
MemoWithDate: Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554) 
 
and the query ran successfully with no issues. So, I am assuming that either an office update or something is haywire with the database has recently occurred. I have checked vba references and there are no missing references. 
 
I am not sure where to go from here. Can someone help me find a solution. My user is to the point of extreme frustration with me. 
 
Thank You
 
Jim Wagner

Re: [MSAccessProfessionals] Invalid Procedure Call error

Crystal,
 
That's a great point about handling NULL values, but I interpret the words "Null value" a little differently than you may.
 
All:
(for general discussion purposes) What NULL means in your database:
It COULD mean literally anything. It specifically means Nothing.

What I mean by that is this: have you ever read a book or document and come across a blank page with the words "this page left intentionally blank" on it? That is ONE of the possible semantic meanings for a NULL in your database data. It also CAN mean: "no entry yet exists for this value", "the value here was deleted", "this value is undefined or uninitialized", amongst other semantic meanings that can be applied to the presence of a NULL value in your data.
It's only truly inarguable MEANING of a NULL value is: "there is no data here"

Now as to how we developers THINK about and prepare to handle NULLs (especially unexpected NULLs), well, there are several schools of thought.
One is that it is simple to append an empty string everywhere that unexpected NULLs can be encountered (which is what Crystal did) and thereby eliminate any errors arising from unexpected NULL values in your data, preserving the effectiveness of your query expressions (and related code).
Another is that while that IS simple, it can also obfuscatory.
What if it was crucial to know when a null value unexpectedly arose? Using the ' & "" ' method can effectively obfuscate those cases from being discovered or handled appropriately (to fix the missing data, say).
 
For that reason, I'm generally more in favor of explicitly handling nulls by using NZ() functions within any expression where NULL is a tripping hazard of significance. For example, using an expression like NZ([tblMaxCompensatoryMemo].[Paragraph2], "*** Missing Paragraph 2 data! ***") would achieve the same expression-safety result, but it would add a textual alert to point out the missing data.

Is this always necessary? No. Is it perhaps the better coding habit to use than ' & "" '? I will leave that for you to decide.
 
On 10/10/2024 3:57 PM EDT Mark Burns via groups.io <mburns_08109=comcast.net@groups.io> wrote:
 
 
Jim,  Yup, that'd do it...the solution, if you want to keep doing that 554 character trimming, would be to wrap that expression in an iif() function.
(Warning: "air code" follows)
MemoWithDate: iif(Len([tblMaxCompensatoryMemo].[Paragraph2]) > 554, Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554), [tblMaxCompensatoryMemo].[Paragraph2])
 
 
On 10/10/2024 11:52 AM EDT Jim Wagner <josephwagner2@outlook.com> wrote:
 
 
Duane,
242 characters with spaces
 
Jim Wagner
 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent: Thursday, October 10, 2024 8:50 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 
Thank You Duane. I will look
 
Jim Wagner
 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Duane Hookom <duanehookom@hotmail.com>
Sent: Thursday, October 10, 2024 7:26 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 
I would first look at the number of characters in Paragraph2 to make sure it's more than 554 characters.
 
Duane
 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent: Thursday, October 10, 2024 8:40 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: [MSAccessProfessionals] Invalid Procedure Call error
 
Hello All,
 
Yesterday I started to get an error message for "Invalid Procedure call" when I tried to open a report. This report has been running for years with no issues. This morning after several hours, I deleted from the query this line 
 
MemoWithDate: Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554) 
 
and the query ran successfully with no issues. So, I am assuming that either an office update or something is haywire with the database has recently occurred. I have checked vba references and there are no missing references. 
 
I am not sure where to go from here. Can someone help me find a solution. My user is to the point of extreme frustration with me. 
 
Thank You
 
Jim Wagner

Re: [MSAccessProfessionals] Invalid Procedure Call error

Jim,  Yup, that'd do it...the solution, if you want to keep doing that 554 character trimming, would be to wrap that expression in an iif() function.
(Warning: "air code" follows)
MemoWithDate: iif(Len([tblMaxCompensatoryMemo].[Paragraph2]) > 554, Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554), [tblMaxCompensatoryMemo].[Paragraph2])
 
 
On 10/10/2024 11:52 AM EDT Jim Wagner <josephwagner2@outlook.com> wrote:
 
 
Duane,
242 characters with spaces
 
Jim Wagner
 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent: Thursday, October 10, 2024 8:50 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 
Thank You Duane. I will look
 
Jim Wagner
 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Duane Hookom <duanehookom@hotmail.com>
Sent: Thursday, October 10, 2024 7:26 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 
I would first look at the number of characters in Paragraph2 to make sure it's more than 554 characters.
 
Duane
 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent: Thursday, October 10, 2024 8:40 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: [MSAccessProfessionals] Invalid Procedure Call error
 
Hello All,
 
Yesterday I started to get an error message for "Invalid Procedure call" when I tried to open a report. This report has been running for years with no issues. This morning after several hours, I deleted from the query this line 
 
MemoWithDate: Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554) 
 
and the query ran successfully with no issues. So, I am assuming that either an office update or something is haywire with the database has recently occurred. I have checked vba references and there are no missing references. 
 
I am not sure where to go from here. Can someone help me find a solution. My user is to the point of extreme frustration with me. 
 
Thank You
 
Jim Wagner

Re: [MSAccessProfessionals] Invalid Procedure Call error

hi Jim,

> reason for the 554 ... do not remember the reason

perhaps something is automatically appended at the end? Look at the data ...

is Paragraph2 something contcatenated in a query? Where does it come from? A table? A query? I see the calculated field name is "MemoWithDate" ... but I don't see any date -- where does the date come from?

Anyhow,
to convert the expression you posted to what I would do for that expression: append "" to any field tested with LEN or LEFT (to handle Null cases), and testing length before deciding what to do:

1. show whatever is there if length of Paragraph2 < 554

MemoWithDate: iif( Len(tblMaxCompensatoryMemo.Paragraph2 & "") > 554, Left([tblMaxCompensatoryMemo].[Paragraph2] & "", Len([tblMaxCompensatoryMemo].[Paragraph2] & "")-554, tblMaxCompensatoryMemo.Paragraph2)

2. show nothing if length of Paragraph2 < 554

MemoWithDate: iif( Len( tblMaxCompensatoryMemo.Paragraph2 & "") > 554, Left([tblMaxCompensatoryMemo].[Paragraph2] & "", Len([tblMaxCompensatoryMemo].[Paragraph2] & "")-554, "")

as Duane said, if you send a negative number for the number of characters for the LEFT function, this is the error message:

Run-time Error '5';
Invalid Procedure Call or Argument

either of the examples above should avoid that error by testing the length first -- and ensuring that True and False expressions evaluate successfully� no matter what.


When you concatenate with &, result can be non-null even when one or more of the parts evaluates to Null. Null is ignored when using & ... unless everything is null, in which case, you'll still have Null. That's why using the plus operator ( somefield + whatever ) & ... produces different results.


Null means the ABSENCE of a value. Many say 'Null Value', but to me, Null and Value are mutually exclusive...


kind regards,
crystal


On 10/10/2024 12:03 PM, Jim Wagner wrote:
Crystal,

many years ago, the users wanted a report with different paragraphs stating company policy and compliance to those policies on the report with data from the tables for comp time. That would be easy. Just put labels on the report with the company policies and be done. But the VP was very formal and insisted that the paragraphs be justified. Well, that meant that the paragraphs had to be in a table to populate text boxes that were in rich text format. I had to ask for help in this and other Access groups to find a solution. The 554 is one of the things suggested. It has worked for years until yesterday. I am not sure why it stopped�working but the reality was that it did, and my main user was upset and under many deadlines with one of her staff out. So, she took it out on me and the Access database. The report was supposed�to be sent out Monday but that has since gone and past. So, the reason for the 554 is that I do not remember�the reason. There are 3 paragraphs on the report but for some reason this is the only one that decided it was going to act like it did not care about others but itself.�

Sorry for the long response.�

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of crystal (strive4peace) via groups.io <strive4peace2008=yahoo.com@groups.io>
Sent: Thursday, October 10, 2024 9:50 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
�

hi Jim,

What are you trying to do ? ... just decease size by 554 -- or would you rather set the size to a particular number?

... maybe this? Where MAXNUMBER is the max characters you want to show

MemoWithDate: iif( Len( tblMaxCompensatoryMemo.Paragraph2 & "") > MAXNUMBER,
Left( tblMaxCompensatoryMemo.Paragraph2 & "", MAXNUMBER), tblMaxCompensatoryMemo.Paragraph2)

reason "" is concatenated to field to test is that LEN returns Null if Paragraph2 doesn't have a value.

"" also appended to True part because IIF evaluates both True and False so they both have to work, and LEFT also only works with strings, not Null. Appending "" turns a Null into a zero-length string so LEN and LEFT can both work

What is the reason for 554?

kind regards,
crystal


On 10/10/2024 11:23 AM, Duane Hookom wrote:
I believe if you have less than 554 characters the Left() function will attempt to return 242-554. This should generate an error. For instance,
? Left("This is a test of len and left",-3)�

generates the error message:

Run-time Error '5';
Invalid Procedure Call or Argument

Duane


From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent:�Thursday, October 10, 2024 10:52 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�Re: [MSAccessProfessionals] Invalid Procedure Call error
�
Duane,
242 characters with spaces

Jim Wagner

From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent:�Thursday, October 10, 2024 8:50 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�Re: [MSAccessProfessionals] Invalid Procedure Call error
�
Thank You Duane. I will look

Jim Wagner

From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Duane Hookom <duanehookom@hotmail.com>
Sent:�Thursday, October 10, 2024 7:26 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�Re: [MSAccessProfessionals] Invalid Procedure Call error
�
I would first look at the number of characters in Paragraph2 to make�sure it's more than 554 characters.

Duane

From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent:�Thursday, October 10, 2024 8:40 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�[MSAccessProfessionals] Invalid Procedure Call error
�
Hello All,
�
Yesterday I started to get an error message for "Invalid Procedure call" when I tried to open a report. This report has been running for years with no issues. This morning after several hours, I deleted from the query this line�
�
MemoWithDate: Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554)�
�
and the query ran successfully with no issues. So, I am assuming that either an office update or something is haywire with the database has recently occurred. I have checked vba references and there are no missing references.�
�
I am not sure where to go from here. Can someone help me find a solution. My user is to the point of extreme frustration with me.�
�
Thank You
�
Jim Wagner

Re: [MSAccessProfessionals] Invalid Procedure Call error

Crystal,

many years ago, the users wanted a report with different paragraphs stating company policy and compliance to those policies on the report with data from the tables for comp time. That would be easy. Just put labels on the report with the company policies and be done. But the VP was very formal and insisted that the paragraphs be justified. Well, that meant that the paragraphs had to be in a table to populate text boxes that were in rich text format. I had to ask for help in this and other Access groups to find a solution. The 554 is one of the things suggested. It has worked for years until yesterday. I am not sure why it stopped working but the reality was that it did, and my main user was upset and under many deadlines with one of her staff out. So, she took it out on me and the Access database. The report was supposed to be sent out Monday but that has since gone and past. So, the reason for the 554 is that I do not remember the reason. There are 3 paragraphs on the report but for some reason this is the only one that decided it was going to act like it did not care about others but itself. 

Sorry for the long response. 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of crystal (strive4peace) via groups.io <strive4peace2008=yahoo.com@groups.io>
Sent: Thursday, October 10, 2024 9:50 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 

hi Jim,

What are you trying to do ? ... just decease size by 554 -- or would you rather set the size to a particular number?

... maybe this? Where MAXNUMBER is the max characters you want to show

MemoWithDate: iif( Len( tblMaxCompensatoryMemo.Paragraph2 & "") > MAXNUMBER,
Left( tblMaxCompensatoryMemo.Paragraph2 & "", MAXNUMBER), tblMaxCompensatoryMemo.Paragraph2)

reason "" is concatenated to field to test is that LEN returns Null if Paragraph2 doesn't have a value.

"" also appended to True part because IIF evaluates both True and False so they both have to work, and LEFT also only works with strings, not Null. Appending "" turns a Null into a zero-length string so LEN and LEFT can both work

What is the reason for 554?

kind regards,
crystal


On 10/10/2024 11:23 AM, Duane Hookom wrote:
I believe if you have less than 554 characters the Left() function will attempt to return 242-554. This should generate an error. For instance,
? Left("This is a test of len and left",-3)�

generates the error message:

Run-time Error '5';
Invalid Procedure Call or Argument

Duane


From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent:�Thursday, October 10, 2024 10:52 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�Re: [MSAccessProfessionals] Invalid Procedure Call error
�
Duane,
242 characters with spaces

Jim Wagner

From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent:�Thursday, October 10, 2024 8:50 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�Re: [MSAccessProfessionals] Invalid Procedure Call error
�
Thank You Duane. I will look

Jim Wagner

From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Duane Hookom <duanehookom@hotmail.com>
Sent:�Thursday, October 10, 2024 7:26 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�Re: [MSAccessProfessionals] Invalid Procedure Call error
�
I would first look at the number of characters in Paragraph2 to make�sure it's more than 554 characters.

Duane

From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent:�Thursday, October 10, 2024 8:40 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�[MSAccessProfessionals] Invalid Procedure Call error
�
Hello All,
�
Yesterday I started to get an error message for "Invalid Procedure call" when I tried to open a report. This report has been running for years with no issues. This morning after several hours, I deleted from the query this line�
�
MemoWithDate: Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554)�
�
and the query ran successfully with no issues. So, I am assuming that either an office update or something is haywire with the database has recently occurred. I have checked vba references and there are no missing references.�
�
I am not sure where to go from here. Can someone help me find a solution. My user is to the point of extreme frustration with me.�
�
Thank You
�
Jim Wagner

Re: [MSAccessProfessionals] Invalid Procedure Call error

hi Jim,

What are you trying to do ? ... just decease size by 554 -- or would you rather set the size to a particular number?

... maybe this? Where MAXNUMBER is the max characters you want to show

MemoWithDate: iif( Len( tblMaxCompensatoryMemo.Paragraph2 & "") > MAXNUMBER,
Left( tblMaxCompensatoryMemo.Paragraph2 & "", MAXNUMBER), tblMaxCompensatoryMemo.Paragraph2)

reason "" is concatenated to field to test is that LEN returns Null if Paragraph2 doesn't have a value.

"" also appended to True part because IIF evaluates both True and False so they both have to work, and LEFT also only works with strings, not Null. Appending "" turns a Null into a zero-length string so LEN and LEFT can both work

What is the reason for 554?

kind regards,
crystal


On 10/10/2024 11:23 AM, Duane Hookom wrote:
I believe if you have less than 554 characters the Left() function will attempt to return 242-554. This should generate an error. For instance,
? Left("This is a test of len and left",-3)�

generates the error message:

Run-time Error '5';
Invalid Procedure Call or Argument

Duane


From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent:�Thursday, October 10, 2024 10:52 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�Re: [MSAccessProfessionals] Invalid Procedure Call error
�
Duane,
242 characters with spaces

Jim Wagner

From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent:�Thursday, October 10, 2024 8:50 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�Re: [MSAccessProfessionals] Invalid Procedure Call error
�
Thank You Duane. I will look

Jim Wagner

From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Duane Hookom <duanehookom@hotmail.com>
Sent:�Thursday, October 10, 2024 7:26 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�Re: [MSAccessProfessionals] Invalid Procedure Call error
�
I would first look at the number of characters in Paragraph2 to make�sure it's more than 554 characters.

Duane

From:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent:�Thursday, October 10, 2024 8:40 AM
To:�MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject:�[MSAccessProfessionals] Invalid Procedure Call error
�
Hello All,
�
Yesterday I started to get an error message for "Invalid Procedure call" when I tried to open a report. This report has been running for years with no issues. This morning after several hours, I deleted from the query this line�
�
MemoWithDate: Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554)�
�
and the query ran successfully with no issues. So, I am assuming that either an office update or something is haywire with the database has recently occurred. I have checked vba references and there are no missing references.�
�
I am not sure where to go from here. Can someone help me find a solution. My user is to the point of extreme frustration with me.�
�
Thank You
�
Jim Wagner

Re: [MSAccessProfessionals] Invalid Procedure Call error

I believe if you have less than 554 characters the Left() function will attempt to return 242-554. This should generate an error. For instance,
? Left("This is a test of len and left",-3) 

generates the error message:

Run-time Error '5';
Invalid Procedure Call or Argument

Duane


From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent: Thursday, October 10, 2024 10:52 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 
Duane,
242 characters with spaces

Jim Wagner

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent: Thursday, October 10, 2024 8:50 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 
Thank You Duane. I will look

Jim Wagner

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Duane Hookom <duanehookom@hotmail.com>
Sent: Thursday, October 10, 2024 7:26 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Invalid Procedure Call error
 
I would first look at the number of characters in Paragraph2 to make sure it's more than 554 characters.

Duane

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Jim Wagner <josephwagner2@outlook.com>
Sent: Thursday, October 10, 2024 8:40 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: [MSAccessProfessionals] Invalid Procedure Call error
 
Hello All,
 
Yesterday I started to get an error message for "Invalid Procedure call" when I tried to open a report. This report has been running for years with no issues. This morning after several hours, I deleted from the query this line 
 
MemoWithDate: Left([tblMaxCompensatoryMemo].[Paragraph2],Len([tblMaxCompensatoryMemo].[Paragraph2])-554) 
 
and the query ran successfully with no issues. So, I am assuming that either an office update or something is haywire with the database has recently occurred. I have checked vba references and there are no missing references. 
 
I am not sure where to go from here. Can someone help me find a solution. My user is to the point of extreme frustration with me. 
 
Thank You
 
Jim Wagner