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 
Access 16 Subform
William Cohee 
  
2 years ago
I need to have the user enter a project number and click a button to populate a subform with the correct table data. However I keep getting error '2467' the expression you entered doesn't exist

The part that is highlighted is Me.MySubform.Form.RecordSource says not open or doesn't exist.
Sami Shamma  @Reply  
             
2 years ago
Show your code
William Cohee OP  @Reply  
  
2 years ago
DetailsPrivate Sub Command8_Click()
    Dim cmdTableName As String
    Dim selectedTable As String
    ' Get the table name from the text box
   selectedTable = Me.Text118.Value
    ' Set the RecordSource of the subform to the selected table
    Me.MyForm.Form.RecordSource = "SELECT * FROM " & selectedTable ' this is line that triggers error
    ' Refresh the subform to display the data
    Me.MyForm.Form.Requery
End Sub
Alex Hedley  @Reply  
           
2 years ago
Example referencing Form or SubForm fields:
=Forms!FormName!FieldName
Or...
=Forms!ParentForm!SubForm.Form!FieldName
Alex Hedley  @Reply  
           
2 years ago
One minor comment, it might be worth naming your Forms in a more descriptive way, and the same with your Controls.
MyFormCommand8 and Text118 might become hard to remember what they do.
Alex Hedley  @Reply  
           
2 years ago
Can you confirm that the value from the textbox is what your expect?

Either Debug.Print selectedTable or MsgBox selectedTable.
William Cohee OP  @Reply  
  
2 years ago
Yes. It is as it should be.
Alex Hedley  @Reply  
           
2 years ago
William Cohee OP  @Reply  
  
2 years ago
I finally figured it out. When you start the code, i.e. Me.Form.Action
I stopped on the "." and looked through the options listed and finally picked
one that did what I wanted done. So, if the option is not in the list then it
won't work.

Thanks for everybodies help. I appreciate it.

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/9/2026 1:08:22 AM. PLT: 1s