Macros and Programming


CardboxForumsMacros and Programming > "Missing a image field on export"

Missing a image field on export

Images.Count does not recognise all the image fields in a record

Posted By Post


11-Jan-2016 13:14

Hi Everyone.

I have a record that contains two image fields but when using Images.Count it does not recognise one of those fields.

I have been using the example that was given in an earlier topic that does export one of the image fields but not all images from a record.

Code Example being used:
for x = Recordposition to Records.Count
   Set rec = activerecord
   fi = "record_" & x
   for n = 1 to rec.Images.Count
      Set img=rec.Images.Item(n)
      img.WriteToFile fld & fi & "_" & n & ".jpg" , cbxImageNonBMP+cbxImageOverwriteFile

Any help would be gratfully received :)


11-Jan-2016 16:01

If you have more than 1 image field, the 'extra' fields you can call by
set img=rec.Fields("fieldname").Images.Count etc


13-Jan-2016 08:59

Thanks very much for the quick response.

This still does not seem to work as when I look through the object browser while debugging the image count for that field still shows 0 even though there is an image there.

Have you seen anything like this before?


13-Jan-2016 12:21

I think your are doing something not right:

Test this for an imagefield called IMAGEFIELD2 (or change it to your fieldname):

set arec = ActiveRecord
msgbox arec.Fields("IMAGEFIELD2").Images.Count

This will certainly reports you the number of images in that field.


20-Jan-2016 14:03

Hi guys

Could you let me know how to add a second image field?
I've searched help and I previously though only one image field was possible.

When I try to add another one, 'image' is greyed out on field type.

Thanks in advance!


20-Jan-2016 15:35

I'me sure this is also mentioned in another thread....
Because it is not 'official' supported, it is not in the help.
But it's easy: edit nave format, select your image field, than ctrl-C, then ctrl-V - paste it with the name you want. You can use both fields identical (files, images etc).
If you want to use F12 to look in your image window of a record, you see default the first image field. However, first click on the second image field, F12 shows you the image window with the second image field.
It is a secret option. So, keep it silent ;-)

© 2010 Cardbox Software Limited   Home