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 
Filling Fields Based on A lookup
Kent Morstain 
    
3 years ago
I am a newbie here and I'm in need of help. I have a form "fsubExistingStudent" that has multiple fields (TDCJ, LastName, FirstName, Address, etc) that I need the form to populate based on the field TDJC which is an 8-digit number (formatted as text) that I enter.

This form is tied to the table "tblStudents" which has all the fields defined. I have researched this on the web, watched Rick's videos, and tried multiple things to get the form to populate based on the TDCJ info entered.

Below is what I currently have in an AfterUpdate for TDCJ.

Private Sub TDCJ_AfterUpdate()

    TDCJ = DLookup("TDCJ", "tblStudents", "TDCJ='" & TDCJ & "'")

End Sub

This should be simple but I cannot figure it out.

Any help would be appreciated and if any additional information is needed I would be happy to supply whatever is needed.

Thanks,

Kent
Kevin Robertson  @Reply  
          
3 years ago
Looks like you're looking up the field you just entered.
Look up each individual field you want to populate.

For example:
FirstName = DLookup("FirstName", "tblStudents", "TDCJ='" & TDCJ & "'")
LastName = DLookup("LastName", "tblStudents", "TDCJ='" & TDCJ & "'")


DLookup
After Update
AfterUpdate & DLookup
Kent Morstain OP  @Reply  
    
3 years ago
I entered the code above for LastName and FirstName respectively as an AfterUpdate and Last Name and First Name Fields on my form did not change but stayed blank.  I recently signed up for a silver membership and I thought there was a button to upload screenshots, but it is not there anymore.

So to recap, I have a form with multiple fields such as Last Name, First Name, Address, what prison lesson we mailed them, and what lesson they returned.  That lesson is then graded and they get the next lesson.  The form (fsubExistingStudent) ties to a table called tblStudents.  Right now I have dummy records in the table.

As an aside, there are other issues that I have not dealt with until I get the above working.  Assuming we can get the above working, can I use you for assistance with those as well?

Thanks
Kent

They say a picture is worth a thousand words, so this would probably be easier to understand what I am trying to do.

Please advise

Kent
Kent Morstain OP  @Reply  
    
3 years ago

Kent Morstain OP  @Reply  
    
3 years ago

Kent Morstain OP  @Reply  
    
3 years ago

Kent Morstain OP  @Reply  
    
3 years ago
Here are some screenshots of my project.  I noticed that now with the AfterUpdate changes, the TDCJ (see screenshot #1) has nothing in it but when you click on it, all the information in the table displays.

Thanks for the help.

Kent
Kent Morstain OP  @Reply  
    
3 years ago
One other thing is the table in the above screenshot #1, has new records (See TDJC # 44444444) being written every time I put in a TDCJ number.  This should not happen as nothing is being written.  Only when the lessons change will a new record be entered.

Hope that helps.

Kent
Scott Axton  @Reply  
        
3 years ago
I see that you found the add image button.  FYI - you can only add an image to an existing post.  Not to an original post.

Kent I'm going to be the bad guy here.  I advise that you put your project on hold - for now - and concentrate on learning Access and some of the db theory.  It will save you TONS of heartache and headache in the long run.
  
I see you just added in the Learning Connection to have access to the regular courses.  I congratulate you on that!  Smart move.  The TechHelp memberships are great supplemental videos to learning the materials in the courses but aren't really a replacement.

Right off the bat - the whole idea is you don't want duplicated information in your data.  Through the courses you will learn the meaning to relational in Relational Database which is what Access is.

Take a look at the Normalizing Data (link) video.  I wish early on in my journey I had had that video. It would have helped make things make more sense.

We could easily overwhelm you with videos to watch to do certain things but that would be counter productive.
Kent Morstain OP  @Reply  
    
3 years ago
Thanks for the encouragement and I look forward to the videos.  However, I'm in a little bit of a time crunch, so is there a video or videos that will help me go forward with this project now?

Thanks in advance.
Scott Axton  @Reply  
        
3 years ago
I get it but really concentrate on the courses.  YOU GOT THIS!

Check out the ZIP Code Lookup video.  That one shows you how to create a lookup table that brings the data into your existing record.  The side benefit is that you can actually incorporate it into your database as a useful addition.  You can probably put the additional Template video on the back burner for the future.

The old saying of you have to learn to crawl before you run truly applies here.  Take the time to build the projects as Richard is building them before trying to utilize them in your own situation.  You build muscle memory (brain muscle) that way.  Each little bit you learn will become the stepping stone to the next level.  You would never take a kid that has never driven before and sit them in the seat saying OK were going to learn to drive today. Oh by the way it's 5:00 Friday in rush hour traffic AND were going to get on the highway to learn.

For instance I see in the photos above that you have a stored StudentFullName. That is actually not advisable since it can be derived from the FirstName and LastName using a query.
Other things like relating tables properly. For instance courses to teachers to students.  That is called a Many-to-Many relationship and is a little more difficult to grasp in the beginning.

Question:  What exactly is TDCJ?
Kent Morstain OP  @Reply  
    
3 years ago
The database I am working on tracks bible study lessons from each prisoner in Texas for those who sign up.  The "TDCJ" number is a tracking number used by the prison system that they use to track each inmate.  Since it is unique, I can use it to find the inmate and track their progress.

One thing I have not mentioned is that a requirement by the prison system is that we maintain a running total of each course they have completed.  Conversely, if they leave the program, that has to be documented and kept on file.

If that changes anything I need to look at, please let me know.

Lots of studying to do.

Thanks
Kent Morstain OP  @Reply  
    
3 years ago
Per the recommendation, I have watched all 3 of my Beginner levels that I am entitled to and still require some assistance on how best to fill in the forms based on the lookup of each student.  I took the free template (TechHelp Free Template v1.93.accdb) from Richard and made it my own.

The student lookups work now, but the fields for current lessons, and the history for each student are is what currently my headache.

Please see the attached form for details.
Kent Morstain OP  @Reply  
    
3 years ago

Richard Rost  @Reply  
           
3 years ago
I understand that you need assistance with your specific database, but it can be more challenging for us to provide tailored answers without a clear view of all its parts. Generic questions like "how do I do this?" are easier for us to answer with instructions or video references.

When it comes to inquiries about a unique database, like yours, it becomes harder to assist without knowing your table structure, queries, and other elements. For example, from your last posted screenshot, it's difficult for me to discern what's happening there without more context or a broader view.

If you're in a hurry, considering posting in the paid forum could be an effective option. This way, we can devote more focused time and resources to your specific needs.

And yeah, Access Beginner 1-3 isn't going to cover this stuff. This is more advanced - at least Expert level.

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/1/2026 8:59:04 PM. PLT: 0s