On Thu, 20 May 2010 03:10:01 -0700, tina
<(E-Mail Removed)> wrote:
PK = primary key. That little key symbol on the toolbar to assign this
special index to this field(s). Tells the table what field(s) make a
unique record.
FK = foreign key. The field on the "many" side of a one-to-many
relationship. Typically a long integer holding the same value as the
PK of the parent table. Created by using the Relationships window and
establishing a link between the parent and child tables. Then check
the box to enforce the relationship.
Yes, you can use the Attachment field if using ACCDB database. If you
only wanted to store the (possibly relative) path, you can use text.
-Tom.
Microsoft Access MVP
>Thank you Tom
>
>Makes lot of sense creating Table for safety hazard its been a while since I
>worked in access.
>
>Sorry to be bit silly but could you please explain what pk and fk are?
>MY tblSafetyHazard
>will have attachments to network with images required
>so will have to be attachment not text?
>
>thanks
>tina
>"Tom van Stiphout" wrote:
>
>> On Wed, 19 May 2010 07:03:01 -0700, tina
>> <(E-Mail Removed)> 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
>> .
>>
|