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 
Attachment Size and Count Limits
John Mark 

14 months ago
Do you happen to have any videos on how to use the Access Attachment field type and limit the sizes of the attachments and also the number of attachments? I searched your forum and could not find anything.  Actually all of google just says dont do it and I agree.  but i want to do it anyway.  Any suggestions?

Thanks!
JM
Adam Schwanz  @Reply  
           
14 months ago
I would not do it. Why do you have to do it this way? It's just as easy to do it the right way unless you have some weird situation that is easier to do it wrong then set something up that works. Watch Images about how to do it right.

Edit: Here's a quick example from ChatGPT, but I would not go down this route it's going to cause issues..

Private Sub Form_BeforeUpdate(Cancel As Integer)
    Dim attachmentCount As Integer
    Dim rs As DAO.Recordset
    Dim attachmentField As DAO.Field

    ' Check if the attachment field has data
    Set rs = Me.RecordsetClone
    rs.FindFirst "[ID] = " & Me![ID] ' Use the appropriate primary key field here
    
    ' Ensure the record is found
    If Not rs.NoMatch Then
        Set attachmentField = rs![YourAttachmentField] ' Replace YourAttachmentField with your actual field name

        ' Count the attachments
        attachmentCount = attachmentField.Value.RecordCount

        ' Limit to 2 attachments
        If attachmentCount >= 2 Then
            MsgBox "You can only add up to 2 attachments.", vbExclamation
            Cancel = True ' Prevent the update if more than 2 attachments
        End If
    End If
End Sub

John Mark OP  @Reply  

14 months ago
i appeciate that.  but im looking for some code that successfully accomplishes the goal requested.  thank you for any help. jm
Adam Schwanz  @Reply  
           
14 months ago
I edited my post with a code example. Why do you need to do it like that?
John Mark OP  @Reply  

14 months ago
thank you for that code.  will that work with the built in Windows file chooser Dialog Box that is part of the Attachment Field Type in Access?    I do appreciate what you're saying.  I was hoping to test to see how many users would use this feature and what types and how many files they might try to attach.   Thanks again!
jm
Bill Carver  @Reply  
      
14 months ago
I think John what the guys are trying to say is "Attachment fields are bad Mmkay?"  Don't use them.  It will just bloat your database and lead to corruption.    Do take a look at https://599cd.com/1616 which is the same images lesson that was mentioned above.  Now attachment sizes will be far less of a problem limited only by disk space.

I don't see a way to limit the number bytes the file can take.   But if you're not storing them in access, but rather linking them to a directory it will only matter if you're making a four hour feature film.
John Mark OP  @Reply  

14 months ago
I agree now!  Thanks to everyone!   This case is closed!   Enjoy!

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: 4/30/2026 12:12:00 PM. PLT: 0s