A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

attachment in form



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2010, 03:03 PM posted to microsoft.public.access.forms
Tina
external usenet poster
 
Posts: 350
Default attachment in form

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
  #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

  #3  
Old May 20th, 2010, 11:10 AM posted to microsoft.public.access.forms
Tina
external usenet poster
 
Posts: 350
Default attachment in form

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
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

.

  #4  
Old May 21st, 2010, 03:13 PM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default attachment in form

On Thu, 20 May 2010 03:10:01 -0700, tina
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
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

.

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:35 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.