View Single Post
  #2  
Old May 19th, 2010, 03:35 PM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default attachment in form

On Wed, 19 May 2010 07:03:01 -0700, tina
wrote:

It sounds like you currently have 5 fields:
Safetyhazard1
Safetyhazard2
etc.
That's a really bad idea. In a relational database you should not have
"repeating groups" and these fields should be spun off in their own
table. Think "many rows" rather than "many fields".
tblMain
MainID autonumber PK
other_fields

tblSafetyHazards
MainID long int required FK PK
SafetyHazardImage text255 required PK

Now you can store 5 (or any number) of images in the new table.

If you have a rather fixed set of images to choose from, you can
improve the above design by having a table listing the images:
tblImages
ImageID autonumber PK
ImagePath text255 required uniqueindex
ShortDescription text50
other_fields

tblSafetyHazards can now be changed to:
MainID long int required FK PK
ImageID long int required FK PK

In all cases you also need to open the Relationships window and draw
lines between all PK and FK fields, and enforce those relationships
(check the box).

This database design is what Access was designed to be used with, and
therefore other things will fall into place. For example the
master-details form can handle a Main record with its many
SafetyHazards.

-Tom.
Microsoft Access MVP


Hi
I have a form where i require user to select which safetyhazard images are
required for each record upto 5

what is the best way to do this I thought of a check box against each image
if so what code would i use to populate safetyhazard fields in table

thanks
tina