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 
Populating data to different form
Monica Visser 
    
2 years ago
Hi, can someone help? I have a customer order form which contains some information that is relevant to a Job Card form. I would like to create a button on the customer order form to open a new job card form that will be linked to that customer order and be able to input data that is in the job card table as fields but als when opening the new job card it will populate some information from the customer order into this job card form. I am at my wits end as everything i have tried is not working properly. I need assistance as to what i am doing wrong. If you can explain what i would need to do. Thanks in advance 🫣
Sami Shamma  @Reply  
             
2 years ago
Please be more specific. See Rule #2.

send screen shots of your tables in design view
Richard Rost  @Reply  
          
2 years ago
You can either use default values or VBA coding to update those values. Since I don't know how much VBA you know, I'd recommend default values. See Default Value and Value From a Form.
Monica Visser OP  @Reply  
    
2 years ago

Monica Visser OP  @Reply  
    
2 years ago

Monica Visser OP  @Reply  
    
2 years ago

Monica Visser OP  @Reply  
    
2 years ago
Hi there, herewith the code I used, but its not working..... I need the job card directly linked to the Customer Order and to push data from Customer Order to Job Card such as Aircraft type and Enginer serial number as well as the Workscope.... Im not very clued up. But am trying my best to get this right. Private Sub cmdCreateJobCard_Click()
    On Error GoTo Err_Handler
    
    ' Debugging statements to trace button click event
    Debug.Print "Button Clicked"
    
    Dim stDocName As String
    Dim stLinkCriteria As String
    
    stDocName = "frmJobCard"
    stLinkCriteria = "[OrderID] = " & Me![OrderID]
    
    ' Debugging statements to verify values
    Debug.Print "Document Name: " & stDocName
    Debug.Print "Link Criteria: " & stLinkCriteria
    
    ' Check if OrderID is valid before proceeding
    If IsNull(Me![OrderID]) Then
        MsgBox "OrderID is null. Please select a valid order.", vbExclamation
        GoTo Exit_Sub
    End If
    
    ' Open the Job Card form with the selected OrderID
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    
    ' Debugging statement to confirm form opened
    Debug.Print "Job Card form opened"
    
Exit_Sub:
    Exit Sub

Err_Handler:
    MsgBox "An error occurred: " & Err.Description, vbExclamation
    Debug.Print "Error: " & Err.Description
    Resume Exit_Sub
End Sub
Monica Visser OP  @Reply  
    
2 years ago

Monica Visser OP  @Reply  
    
2 years ago

Monica Visser OP  @Reply  
    
2 years ago
Hello, thank you for the response, however the two videos don't really cover what I need. I need to open a job card from the customer order with some information that will populate the job card that is already in a field in the customer order.? If you have a tech help video explaining that, if you can send me the link then I can try and solve it. Thank you so much.
Kevin Yip  @Reply  
     
2 years ago
Your code would only work if the OrderID field were in the main form (frmJobCard), but it's not.  It's in the subform (sbfOrder_JobCard), as your last screenshot shows.  That's why your code doesn't work.  Find a way to put OrderID on the main form, even as a hidden control, if necessary.
Richard Rost  @Reply  
          
2 years ago
This is a question I get asked a lot. "How to push a value to another form." I actually have a video on this subject on my list. I'll bump it up for you.
Kevin Yip  @Reply  
     
2 years ago
Also, your tables show there is a space in the field name "Order ID"; but in your VBA code, you use "OrderID".  What you use in VBA has to match what is on the form, which, in turn, has to match what is in the underlying tables.
Richard Rost  @Reply  
          
2 years ago
Good catch, Kevin.
Juan Rivera  @Reply  
            
2 years ago
how about the DLOOKUP to copy value from one table to new table by matching the ID?  not sure just a thought....
Richard Rost  @Reply  
          
2 years ago
Juan Rivera  @Reply  
            
2 years ago
I SEE said the blind man.... LOL
Richard Rost  @Reply  
          
2 years ago
...to his deaf son.
Monica Visser OP  @Reply  
    
2 years ago

Monica Visser OP  @Reply  
    
2 years ago

Monica Visser OP  @Reply  
    
2 years ago

Monica Visser OP  @Reply  
    
2 years ago

Monica Visser OP  @Reply  
    
2 years ago
Hi there, thanks so much for the video. Very helpful, at least got the Job Card created from the Order and populated some of the data from Order to Job Card, however, after completing the exercise, there is just no way that the new Job Card that was created from the Orders form will save that new record.  You can populate or input data, you can add a save button, I've tried and tried but that "new"record will not save... Don't quite know what I'm doing wrong?
Gary James  @Reply  
      
2 years ago
The method given here to place data, or trigger an action in different forms, certainly works, but there's an alternate method that I use, that I believe makes your code simpler and less prone for errors as the number of forms sharing data increases.   Here's a link to an Access project that demonstrates this alternate method of sharing data or triggering actions in one or more other forms.

https://github.com/NfaToys/Global-Messaging-Events-Class/blob/main/Event%20tests.accdb

Click on the [***] three dots to the Right of the name of the Project to download.    "Event tests.accdb" is a small Access VBA Project that demonstrates the use of a global Class module that provides custom events that allows forms to trigger actions within themselves or with each other.   This Class module concept gives the developer the power of designing custom form events.  Forms can easily trigger actions within themselves, or trigger events in other forms to perform their own actions.   A practical use of this would be a database that has several forms open that share the same data.  When data is changed in one form, ideally you'd want all other forms to update their displays to reflect the change.   This can be done using function calls for each form, but with this approach the code becomes clumsy and hard to maintain when the number of forms sharing data is numerous.   The better way is to use custom Events.  As each form opens it hooks into the Event chain of the global Event class.  Then each form sinks and handles the pertinent events for that form.  And when the form closes it unhooks from the event chain.

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