Solved Don't display EMF in Attachment control with data from subform (1 Viewer)

AFila

New member
Local time
Today, 03:33
Joined
Jan 9, 2021
Messages
4
I can't display content of graphic file(EMF format) in Attachment control on main form.

Attacment's data source refer to field on subform. Maybe I specify wrong reference? On subform control Attachment displays image correctly.

I try different references for Attachment's control data source:

=[Form2].[Form].[FLAGS_EMF]

=[Form2].[Form].[FLAGS_EMF].FileData

Field [FLAGS_EMF] has type Attachment in database MS ACCEESS 2010
 

Attachments

  • Form_EMF.png
    Form_EMF.png
    8.4 KB · Views: 177
  • Form_EMF_constr.png
    Form_EMF_constr.png
    25.9 KB · Views: 177

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:33
Joined
May 7, 2009
Messages
19,231
you can use a Query and use the Attachment column as Controlsource (bound) of the textbox.
or you can SaveToFile the Attachment and use Image Control to show the emf file.
 

AFila

New member
Local time
Today, 03:33
Joined
Jan 9, 2021
Messages
4
you can use a Query and use the Attachment column as Controlsource (bound) of the textbox.
or you can SaveToFile the Attachment and use Image Control to show the emf file.
Thanks for answer. I think use method Attachment.SaveToFile is not good idea.
What do you mean "use Query"? Use another query in controlSource of main Form?
I would like get data for Attachment control on main Form from subform's query. Is it possible?
 

isladogs

MVP / VIP
Local time
Today, 01:33
Joined
Jan 14, 2017
Messages
18,209
According to MS Attach files and graphics to the records in your database - Access (microsoft.com), EMF files can be used in attachment fields.

Nevertheless, most developers recommend that attachment fields (a special type of multivalued field) should be avoided. Using them will embed files in your database causing the Access file size to rapidly increase and reduce performance. Instead store the paths to external files
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:33
Joined
May 7, 2009
Messages
19,231
there are two forms on the demo, BOUND_FORM and UNBOUND_FORM.
see the Current event of the SUBfrm.
 

Attachments

  • flags.accdb
    2.9 MB · Views: 223

AFila

New member
Local time
Today, 03:33
Joined
Jan 9, 2021
Messages
4
UNBOUND_FORM - I understand. Thank you!
BOUND_FORM - gives Error: "Could not find field: IMAGE6"
1610276652594.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:33
Joined
May 7, 2009
Messages
19,231
sorry about that.
 

Attachments

  • flags.accdb
    3.3 MB · Views: 225

AFila

New member
Local time
Today, 03:33
Joined
Jan 9, 2021
Messages
4
Thank you very much!

This is what I was looking for.
 

Users who are viewing this thread

Top Bottom