PC Review


Reply
Thread Tools Rate Thread

attachment in form

 
 
tina
Guest
Posts: n/a
 
      19th May 2010
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
 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      19th May 2010
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

 
Reply With Quote
 
tina
Guest
Posts: n/a
 
      20th May 2010
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

> .
>

 
Reply With Quote
 
Tom van Stiphout
Guest
Posts: n/a
 
      21st May 2010
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

>> .
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot add attachment on a form CK Microsoft Access 0 11th Jun 2009 04:50 PM
how do I forward as attachment with attachment in plain text form. =?Utf-8?B?ZGFyZTJkdjg=?= Microsoft Outlook Discussion 0 18th Jul 2005 10:43 AM
Add attachment to form =?Utf-8?B?TFFVMTE1MTM=?= Microsoft Outlook Form Programming 3 12th Dec 2004 09:33 PM
form as attachment Sofia Microsoft Outlook VBA Programming 1 26th Jan 2004 12:25 PM
Attachment with a form =?Utf-8?B?S2VpdGg=?= Microsoft Frontpage 2 21st Nov 2003 07:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:45 PM.