Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Fitness 76    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Before Insert Error
Hezi Cohen 
    
2 months ago
hi All
I tried using the VBA code Under the Before Insert Event
and I'm getting an Error 3075.
It seems like I'm having a Null Value instead of the Current ID I'm standing on.
what am I doing wrong?
Donald Blackwell  @Reply  
       
2 months ago
Please be more specific. See Rule #2.

Show us the code that is running when error comes up otherwise we have no frame of reference
Kevin Robertson  @Reply  
           
2 months ago
Have you tried wrapping the ID with the NZ Function?
Hezi Cohen OP  @Reply  
    
2 months ago
hi again
0 Value is not an option there get to be a Value
I'm using 3 synchronized subForms
I'm using Father Son connection
this is the Code I use

Private Sub Form_BeforeInsert(Cancel As Integer)
Dim HighestSectionNumber As Double

If Not IsNull(SectionNumber) Then
   Exit Sub
End If
    
    HighestSectionNumber = Nz(DMax("SectionNumber", "ChecklistT", "SectionID=" & SectionID), 0)
    SectionNumber= HighestSectionNumber + 1

End Sub
I get SectionID=Null instead of a Value

Kevin Robertson  @Reply  
           
2 months ago
Change

    If Not IsNull(SectionNumber) Then

To

    If IsNull(SectionNumber) Then

At the moment you are exiting the Sub if SectionNumber has a value.
Kevin Robertson  @Reply  
           
2 months ago
Which lesson of Fitness 76 is this from?
What is the timestamp?
Hezi Cohen OP  @Reply  
    
2 months ago
the form name is RoutineDetailF
(its a subForm  within ProgramRoutineF)
timestamp is 7:37
Hezi Cohen OP  @Reply  
    
2 months ago
hi All
I think I found the solution to my problem.
My Forms are based on queries as data source.
I changed that into tables and Its worked problem is solved.
thank you All
Richard Rost  @Reply  
          
2 months ago
Glad you got it sorted out. Kevin was right to ask which lesson you were following, because that code assumes the parent ID has already been saved and is available when the child record is inserted.

Using a query as a form's Record Source is not automatically a problem, but it can complicate things if the query is not updateable or does not expose the fields Access needs to maintain the parent/child relationship. In this case, basing the forms directly on the tables was the cleanest fix.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Fitness 76.
 

Next Unseen

 
 
What's This?

 

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: 9/10/2026 11:23:52 AM. PLT: 1s