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 Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
TaskNumber in OrderForm
Klaas van Eijkern 

4 years ago
Based on the TechHelp videos Invoicing, Order Entry System and Invoicing Report I have the following question.

From the TaskForm I have a Task number.
This job number is copied into OrderForm.
However, as soon as I enter a new part, from SubForm OrderDetailForm, the Job number is removed.
How can I solve this?
Below is the VBA code.

Code from OrderForm and further down the code from OrderDetailForm:

Option Compare Database
Option Explicit
Private Sub CompanyCombobox_AfterUpdate()
    Me.Refresh
End Sub

Private Sub TaskNmr_AfterUpdate()
    Me.Refresh
End Sub

Private Sub CompanyCombobox_BeforeUpdate(Cancel As Integer)
    If MsgBox("This will change the customer for the current order. Are you sure?", _
        vbYesNoCancel) <> vbYes Then
            Cancel = True
            Exit Sub
    End If
End Sub

Private Sub Form_Current()
If Isloaded("Enter and/or change task data") Then
        CompanyCombobox.DefaultValue = Forms![Enter and/or change job data]!CompanyID
        TaskNmr.DefaultValue = Forms![Enter and/or change task data]!TaskNmr
    Else
        CompanyCombobox.DefaultValue = 0
        TaskNmr.DefaultValue = 0
    End If
End Sub


OrderDetailForm

Option Compare Database
Option Explicit
Private Sub PartsOrderDetailNumber_AfterUpdate()
    Me.Refresh
End Sub

Private Sub PartsOrderDetailPrice_AfterUpdate()
    Me.Refresh
End Sub

Add Private SubComponent_Click()
    If IsNull(PartsListCombo) Then
        DoCmd.GoToControl "PartsOverviewCombo"
        PartsOverviewCombo.Dropdown
        Exit Sub
    End If
    
    If IsNull(Forms!PartsOrderF!PartsOrderID) Then
        Forms!PartsOrderF!PartsOrderDate = Date
        Forms!PartsOrderF.Refresh
            
    End If
        
    DoCmd.GoToRecord , , acNewRec
    PartID = PartsOverviewCombo
    PartsOrderDetailProductName = PartsOverviewCombo.Column(1)
    PartsOrderDetailPiece Price = PartsOverviewCombo.Column(2)
    PartsOrderDetailNotes = Nz(DLookup("PartsOrderDetailNotes", "PartsOverviewT", "PartID=" & "PartsOverviewCombo"), "")
    Me.Refresh
End Sub


I hope you can help me.
Thanks, Klaas
Kevin Yip  @Reply  
     
4 years ago
In your Form_Current() procedure, you only set the default value for TaskNmr.  A default value is used only when a new record is created.  Every time you create a new record, TaskNmr will revert back to the default value.  Maybe that is the cause of the problem.
Klaas van Eijkern OP  @Reply  

4 years ago
Hi kevin,

I understand what you explain.
However, how do I get TaskNmr from the open form into the second form where TaskNmr must be equal to the first?
Juan C Rivera  @Reply  
            
4 years ago

Value from another form: Value From a Form

and Bang Dot....!  Bang! v Dot.
  Richard has a video for everything.... :)
Klaas van Eijkern OP  @Reply  

4 years ago
Thanks Juan, I will look into it.
Klaas van Eijkern OP  @Reply  

4 years ago
Hi Juan,

I've watched both video's and I still can not find the right solution.
=Forms!ParentFormName!OnderdelenOrderF.Form!TaskNmr is not working.

What am I doing wrong?
In VBA, it comes with an error in yellow.
Dan Jackson  @Reply  
            
4 years ago
You need to replace ParentFormName with the name of the parent form

Forms!CustomerF!OnderdelenOrderF.Form!TaskNmr

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 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:49:54 AM. PLT: 1s