Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Back to ChatGPT Gift Shop    Comments List
Upload Images   Link   Email  
Access VBA Code
Juan C Rivera 
           
2 years ago
Have you tried to have it write some code for access?  Maybe this will be a good video on how to use chatgpt to build your access... any thoughts
Richard Rost 
          
2 years ago
But then I'd be out of a job! :)
Richard Rost 
          
2 years ago
Holy crap. I just asked it to do the following:

"Write Visual Basic code for Microsoft Access to loop through the records in the table CustomerT with a recordset and double every customer's credit limit."

And it came back with near perfect code:

---

"To achieve this task, you can use Visual Basic for Applications (VBA) code within Microsoft Access. First, you'll want to create a module in Access and then copy the following code into the module. This VBA code creates a subroutine that loops through the records in the CustomerT table and doubles each customer's credit limit."

Option Compare Database
Option Explicit

Sub DoubleCreditLimit()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strSQL As String
    
    ' Set the database and create the SQL query to select data from the CustomerT table
    Set db = CurrentDb
    strSQL = "SELECT * FROM CustomerT"
    
    ' Open a recordset with the SQL query
    Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
    
    ' Loop through the records in the recordset
    If Not (rs.EOF And rs.BOF) Then
        rs.MoveFirst
        Do Until rs.EOF
            ' Double the credit limit for each customer
            rs.Edit
            rs!CreditLimit = rs!CreditLimit * 2
            rs.Update
            
            ' Move to the next record
            rs.MoveNext
        Loop
    End If
    
    ' Close the recordset and database objects
    rs.Close
    db.Close
    
    ' Release the objects
    Set rs = Nothing
    Set db = Nothing

    ' Inform the user that the process has been completed
    MsgBox "Credit limits have been successfully doubled for all customers in CustomerT table.", vbInformation, "Process Completed"
End Sub


"After you have added the code to the module, you can call the DoubleCreditLimit subroutine to double the credit limits for all customers in the CustomerT table. To do this, you can either run the subroutine directly from the VBA editor or create a button on a form and add an event handler that calls the subroutine when the button is clicked."

---

It still doesn't teach you how to do that or explain what it's doing but yeah it's pretty good at writing the actual code. Understanding that code is a different level however.
Juan C Rivera OP 
           
2 years ago
in your words BOOM! :)  this may save you some time when making videos.  
Richard Rost 
          
2 years ago
Nothing I couldn't do already. After 30 years of learning tvus stuff. Lol
Gary James 
     
2 years ago
I asked ChatGPT to generate similar code for Access VBA to store and access data in a multicolumn listbox.   The code it created looked near perfect until I tried it out.  It was accessing properties that don't exist on the listbox   And likewise calling methods that don't exist.  Bottom line, take what ChatGPT gives you with a fistful of salt.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in ChatGPT Gift Shop.
 

 
 
 

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 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 3/27/2025 7:06:11 PM. PLT: 1s