Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
query results
Lloyd Langham 
   
2 years ago
I have a query with a field "Inv-T3: Eval([Inv-T2])"
Field [Inv-T2] is extracted numeric values from xml code, and I need to sum the field.  if I get too many values it fails (100+ groups of numbers)

Sample of the string in [Inv-T2]  "0 +61.90 +59.80 +62.50 +57.60 +61.60 +62.00 +0"
Lloyd Langham OP  @Reply  
   
2 years ago

Kevin Robertson  @Reply  
          
2 years ago
I'm thinking the String is probably too long. The max length of a String in Access is, I believe, 255 characters.
Adam Schwanz  @Reply  
           
2 years ago
How are you storing/creating Inv-T2? Could be an issue with the 255 character limit depending on how you're doing it.
Lloyd Langham OP  @Reply  
   
2 years ago
Inv-T2 is extracted from a long text field ands it is populated with xml code. This could hold hundreds of values (meat catchweights) Example "<CatchWeights><CatchWeight>10</CatchWeight><CatchWeight>10</CatchWeight></CatchWeights>"

I need to find a way to sum that field.
Adam Schwanz  @Reply  
           
2 years ago
It's a long text field in a table? You could just parse the data and sum it with vba. That's more advanced though.

Is it always this syntax?
Number(space)(plus)number

Or could there be no spaces or subtraction?
Lloyd Langham OP  @Reply  
   
2 years ago
Sorry, I didn't see the space.  Fixed now example: 0+10.00+10.00+0

vba would be the best, my understanding is I need to convert it to a list then sum the list.  I'm not skilled enough for that :(
Adam Schwanz  @Reply  
           
2 years ago
Does it always start with 0? Can it be - instead?
Adam Schwanz  @Reply  
           
2 years ago
Assuming it can only be +. Something like this should work. It assumes you are storing the string value in a table and setting the sum value in a table. This code is in a button on a form and when pressed sums the results in the table.

There may also be more involved if your query is doing more to get the number to that point.

Edit: I made it Short Text in my picture, it works fine with Long Text too and you'd need to use Long Text for the String Value if it was over 255 characters.
Adam Schwanz  @Reply  
           
2 years ago

Lloyd Langham OP  @Reply  
   
2 years ago
The sum is actually going on a report, query supplies data for the invoice report.  instead of a button can it be a field on report?
Adam Schwanz  @Reply  
           
2 years ago
In my example you're going to need to use a table. You may also be able to make a module to run the calculation inside a query.

Edit: This is doing it in a module/query in the image below.
Adam Schwanz  @Reply  
           
2 years ago

Lloyd Langham OP  @Reply  
   
2 years ago
I must have something wrong, it give me a result of 0
Lloyd Langham OP  @Reply  
   
2 years ago

Kevin Yip  @Reply  
     
2 years ago
Typo: you typed "Sun" instead of "Sum" in the code.
Adam Schwanz  @Reply  
           
2 years ago
To confirm, you have MyStringValue stored in the table as Long Text right?

Is there anything else going on in the field properties. Any formatting or input masks or anything?
Are there any spaces or multi-line in your values?

Something else is off. Mine works great. If everything looks normal and it doesn't work, then you're probably going to want to try it in a new database with bare minimum fields/setup like my example photo, and add things on until it breaks and we find the problem.
Adam Schwanz  @Reply  
           
2 years ago
Or that would do it. Nice eye Kevin, I didn't even notice that.
Kevin Yip  @Reply  
     
2 years ago
The real culprit is the lack of Option Explicit, which would've caught the typo as an unknown name.
Richard Rost  @Reply  
          
2 years ago
When I rerecord Developer 1, I'm going to put Option Explicit at the top of the class.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 7:57:22 AM. PLT: 0s