newbie46
asked on
Access 2010 Attachment field - determining length of full path file name
I have an attachment field on a form. Users double-click the attachment box in order to attach documents. Because the documents that they are attaching are within multiple nested folders, the length of the folder names, combined with the length of the attachment file name is exceeding the maximum allowable length of 255 characters.
I have attempted to use VBA in the BeforeUpdate and AfterUpdate events of the attachment field, but processing does not seem to enter either of these subs upon attaching a file.
Is it possible to determine the length of the full path name of the file attached prior to it being attached, so that I can display a message to the user stating that the length of the full path has exceeded the maximum allowable length?
I have attempted to use VBA in the BeforeUpdate and AfterUpdate events of the attachment field, but processing does not seem to enter either of these subs upon attaching a file.
Is it possible to determine the length of the full path name of the file attached prior to it being attached, so that I can display a message to the user stating that the length of the full path has exceeded the maximum allowable length?
Is the field and form attached to a table directly? Can you change the underlying field to be a memo field? And how are you getting the path and file name, using the Open File dialog?
ASKER
jimpen,
>>Is the field and form attached to a table directly?<<
Yes
>>Can you change the underlying field to be a memo field? <<
The field is called AttachedDocuments and is of type Attachment. If it was changed to a Memo field, how would I attach the documents?
>>And how are you getting the path and file name, using the Open File dialog?<<
I am simply referring to AttachedDocuments.FileName to retrieve the filename.
When I create nested folders with folder names of different lengths, I am able to recreate this problem. For example, create a folder name AAAAAAAAAAAAAAAAAAAAAA. Then, create a folder within that and name it BBBBBBBBBBBBBBBBBBBBBBBBBB Bbbb. Then, continue to creating CCCCCCCCCCCCCCCCCCCCccccc, DDDDDDDDDDDDDDDddddd, EEEEEEEEEEEEEEEEEEee, etc. Then, with the field AttachedDocuments displayed on a form whose Default view is Single form, double click the field's box and attach a document that has been stored within folder EEEEEEEEEEEEEEEEEEee. Then, you will be able to see the error that I am receiving.
My goal is to be able to determine the length in characters of folders A, B, C, D, E, etc., in addition to the length of the document being attached. If the length exceeds the maximum allowable length of folder names plus document name length, I want to provide the user with a message to move the document to a different folder in order to attach it. The users store the documents to be attached within multiple nested folders.
Please let me know if this makes sense.
>>Is the field and form attached to a table directly?<<
Yes
>>Can you change the underlying field to be a memo field? <<
The field is called AttachedDocuments and is of type Attachment. If it was changed to a Memo field, how would I attach the documents?
>>And how are you getting the path and file name, using the Open File dialog?<<
I am simply referring to AttachedDocuments.FileName
When I create nested folders with folder names of different lengths, I am able to recreate this problem. For example, create a folder name AAAAAAAAAAAAAAAAAAAAAA. Then, create a folder within that and name it BBBBBBBBBBBBBBBBBBBBBBBBBB
My goal is to be able to determine the length in characters of folders A, B, C, D, E, etc., in addition to the length of the document being attached. If the length exceeds the maximum allowable length of folder names plus document name length, I want to provide the user with a message to move the document to a different folder in order to attach it. The users store the documents to be attached within multiple nested folders.
Please let me know if this makes sense.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.