Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Fitness Get Macros Btn Fails
Julius Cunningham 
     
2 months ago
I have done all Fitness lesson through 73.  

Now the Get Macros button on FoodF does not input the data for the Calories, Fat etc.  I know the process is working because it prints to the FoodF briefly. then disappears.  If I go to an food item that already has the Calories et al, the Get Macros button erases the entries.  I hear a beep after each type of entry.

I can manually input the information and it is saved and everything is normal.

I have checked the underlying codes and modules.  Everything appears to be ok.  Thanks in advance.
John Davy  @Reply  
         
2 months ago
Have you tried a compact and repair? John
Raymond Spornhauer  @Reply  
          
2 months ago
Please show us your code.

-Raymond
Richard Rost  @Reply  
          
2 months ago
Julius like Raymond said, if we can't see your code, we can't tell what's wrong. :)
Julius Cunningham OP  @Reply  
     
2 months ago
Private Sub GetMacrosBtn_Click()

    If IsNull(FoodID) Then Exit Sub
    If Not IsFood Then Exit Sub
    If Not HasFoodGroup() Then Exit Sub
    
    'If Not AreYouSure("Look up nutrient values from OpenAI?") Then Exit Sub
    
    Dim S As String
    Me.Dirty = False 'Refreshes the record
    
    S = AskOpenAI("Please give me the nutrition data for: " & Description, 1)
        
        Calories = FindBetween(S, "[Calories]", "[/Calories]")
        Fat = FindBetween(S, "[Fat]", "[/Fat]")
        Carb = FindBetween(S, "[Carb]", "[/Carb]")
        Fiber = FindBetween(S, "[Fiber]", "[/Fiber]")
        TotalSugar = FindBetween(S, "[TotalSugar]", "[/TotalSugar]")
        Cholesterol = FindBetween(S, "[Cholesterol]", "[/Cholesterol]")
        Protein = FindBetween(S, "[Protein]", "[/Protein]")
        Sodium = FindBetween(S, "[Sodium]", "[/Sodium]")
       Me.Dirty = False 'Refresh the record

End Sub
Raymond Spornhauer  @Reply  
          
2 months ago
It sounds to me like your AskOpenAI is not returning info.  Have you maxed out your API calls?

-Raymond
Julius Cunningham OP  @Reply  
     
2 months ago
How do I check on that?
Julius Cunningham OP  @Reply  
     
2 months ago
I checked API usage. I'm ok.

Besides, as stated above, the GetMacrosBtn retrieves the information and briefly prints it to the FoodF.
Richard Rost  @Reply  
          
2 months ago
The easiest way to tell is to message box it as soon as the response comes in, so you can see what data you're getting back.
Julius Cunningham OP  @Reply  
     
2 months ago
I msgbox Calories and it returned INVALID USE OF NULL
Richard Rost  @Reply  
          
2 months ago
OK. Now MsgBox the response you get from the AI before you try to parse the values out. What does that give you?
Julius Cunningham OP  @Reply  
     
41 days ago
Private Sub GetMacrosBtn_Click()

    If IsNull(FoodID) Then Exit Sub
    If Not IsFood Then Exit Sub
    If Not HasFoodGroup() Then Exit Sub
    
    'If Not AreYouSure("Look up nutrient values from OpenAI?") Then Exit Sub
    
    Dim S As String
    Me.Dirty = False 'Refreshes the record
    
    S = AskOpenAI("Please give me the nutrition data for: " & Description, 1)
    MsgBox S
    
        Calories = FindBetween(S, "[Calories]", "[/Calories]")
        Fat = FindBetween(S, "[Fat]", "[/Fat]")
        Carb = FindBetween(S, "[Carb]", "[/Carb]")
        Fiber = FindBetween(S, "[Fiber]", "[/Fiber]")
        TotalSugar = FindBetween(S, "[TotalSugar]", "[/TotalSugar]")
        Cholesterol = FindBetween(S, "[Cholesterol]", "[/Cholesterol]")
        Protein = FindBetween(S, "[Protein]", "[/Protein]")
        Sodium = FindBetween(S, "[Sodium]", "[/Sodium]")
        Me.Dirty = False 'Refresh the record
      
      

End Sub

S is empty
Richard Rost  @Reply  
          
40 days ago
Well, there you go. Now you've got to figure out why your ask OpenAI function is returning nothing. Now we gotta dig into that, trace into that, and see what's going on there, see what the API is returning.
Julius Cunningham OP  @Reply  
     
32 days ago
Private Function BuildBody(UserContent As String, SystemMessage As String) As String

    Dim SM As String, UC As String, S As String
    
    SM = DoCharSubst(SystemMessage)
    
    UC = DoCharSubst(UserContent)
    UC = FilterCharacters(UC, ALPHANUMERIC & "{} [] . , : ""'() ! @$%&*-_+=;<>?\", " ")
    
    S = "{""model"": """ & MODEL & """," & _
        """messages"": [{""role"": ""system"",""content"":  """ & SM & """}, " & _
                                  "{""role"": ""user"",""content"": """ & UC & """}]}"
                                  
    BuildBody = S
        MsgBox S
        
End Function

At this point S has the information.  I cannot find where S gets emptied b4 it fills out the FoodF
Richard Rost  @Reply  
          
32 days ago
At this point, I think you're missing the fundamentals of how the whole AI system works. Why don't you go back and re-watch my OpenAI introduction video?

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: 8/11/2026 1:32:22 AM. PLT: 0s