When you inserted the 1.7Mb image, was "store by reference" enabled? This is a checkbox that appears in the dialog where you select the image file to insert. If "store by reference" is used, then only a file path to the image file is entered into the container field and this will be much smaller than your specified length limit.
You should be ablet to configure Insert Picture so that the user gets the same "browse" dialog box that you get when you manually select the same option if you don't select any sorce file. Use Go To Field to put the cursor in the container field first, then your next step is Insert Picture. You can then control whether or not "by reference" is the default setting, but I don't see any way to make sure that the user doesn't select this option anyway...
Thanks for the advice! I was able to get an "insert image" button to show the browse screen when it opens but I am still having trouble limiting the size of the picture. I typed: Length (image1)<204800 into the validation calculation box for the field "image1" and tried to insert the image without the "store by reference" box checked and it still let me insert a 7mb image.I would like it to be limited to 500kb at least.
Any thoughts!?! Thanks!
Hmmm, it worked for me.
Here's what I did:
I opened a DB test file with a container field.
I defined cLength as the calculation: Length ( ContainerField ) and placed it on my layout.
I used Insert Picture to insert an image without the "by reference" option selected
I copied the value of cLength to the clipboard. (2503647)
I then added this validation calculation to containerField:
Length ( self ) < 2500000
I then created a new record and inserted the same image with the same options.
When I committed the record by clicking the layout background, the validation error message popped up. If I has specified a custom validation message, this message could have told me that my image file was too large.
you could try to use an auto-enter calculation, instead of the validation option. Something like:
Length ( Self ) ≤ 204800 ; Self ;
Self & " ( " & Round ( Length ( Self ) / 1024 ; 0 ) & " kB ) is too large"