Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Duplicate Record < Work Days | Form Footer Totals >
Back to Duplicate Record    Comments List
How to Handle Null Values Upload Images   Link   Email  
Dan Jackson              
2 years ago
Hi,

In the ext cut, you assume all the fields will have values. On my form, i have

Person 1 First Name
Person 1 Last Name
Person 2 First Name
Person 2 Last Name

When attempting to do a partial duplicate, it errors when theres null values in person 2. How do we resolve this? Thanks
Kevin Robertson            
2 years ago
Do this replacing FirstName with whatever your field is called.

If Not IsNull(Me!FirstName) Then
    FirstName = Me!FirstName
End If
Dan Jackson              
2 years ago
Awesome! Thank you!
Dan Jackson              
2 years ago
Hmm.... Isn't working. When i run the duplicate record, it goes to a new record but doesn't copy any of the fields

This is a copy of the top section, simplified. Does it look right?

=====================

Dim LA1FirstName As String, LA1Surname As String, LA2FirstName As String, LA2Surname As String
        
    LA1FirstName = Me!LA1FirstName
    LA1Surname = Me!LA1Surname
        If Not IsNull(Me!LA1FirstName) Then
            LA2FirstName = Me!LA2FirstName
        End If
        If Not IsNull(Me!LA2Surname) Then
            LA2Surname = Me!LA2Surname
        End If

======================

I commented out the above 6 "If" lines and the 6 "If" lines in the lower section and it now works for LA1 so the issue is defo with the If part. Thank you
Dan Jackson              
2 years ago
Here is a screenshot of my code. I've blanked out parts i know are working for ease of reading - this is with scotts suggestion but the duplication doesn't happen, it just goes to a new record. thanks
Dan Jackson              
2 years ago

Dan Jackson              
2 years ago
Sorry, i meant to say, the commented bits aren't working.

The .onerror one is where i'm trying to generate an error message when the required fields aren't complete and clicking the dupe button does nothing
Kevin Robertson            
2 years ago

Dan Jackson              
2 years ago
Thank You Kevin. Makes Perfect Sense. Funilly enough, it wouldn't copy LA2 details and was thinking something was wrong. Spent ages trying different things and messing around before i realised that i did the "If Not" statements on the lower half as well! Only saw my error when i took another look at your image.

Thank You!

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

 
 
 

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 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/24/2024 7:37:00 AM. PLT: 1s