Need help with duplicates in form text boxes

G

Guest

I have created a form to document how much time a TECHNICIAN
spent on a particular task. The form layout is as follows:

TECHNICIAN---START DATE---START TIME---FINISH TIME---DURATION
_____________________________________________________________
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXX

(The section above the line is the heading section) The "XXXXX" sections
consist of the corresponding data for those headings. I had created 9 extra
boxes for the extra TECHNICIANS that worked on a specific task. How can I
have the form not duplicate the 1st line...

Example--> if I have the following info:

TECHNICIAN---START DATE---START TIME---FINISH TIME---DURATION
_____________________________________________________________
JOHN 1/1/00 12:00 1:30 1.5

The above info of John's will duplicate in the remaining 9 boxes of the
form. Is there a way I can prevent this from happening?

Sorry for the redundancy.

Joe
 
S

strive4peace

create main form and subforms
---

Hi Joe,

You should store Date and Time together -- otherwise, you will have real
problems if the task starts before midnight and ends after midnight ...
besdies, Date and Time SHOULD be one field, not 2 -- you can always show
it seperately on the form.

You need to use a main form and subform

You need these 3 tables:

*Technicians*
TechID, autonumber
Lastname, text
Firstname, text
etc

*Tasks*
TaskID, autonumber
Task, text
etc

*TechTasks*
TechTaskID, autonumber
TechID, long integer -- FK to Technicians table
TaskID, long integer -- FK to Tasks table
StartDateTime, Date/time
EndDateTime, Date/time

~~~

each form/subform should be based on just one table ... you will need a
main form to for the main table (either Technicians or Tasks, depending
on how you want to enter the data) and a subform to display and edit
information in the related table, TechTasks

Create the main form and the forms that will be used as a subform --
make sure to put the ID fields on them

for the taskID, use a combobox:
ControlSource --> TaskID
RowSource --> SELECT TaskID, Task FROM Tasks ORDER BY Task
ColumnWidths --> 0;3
ListWidth --> 3 (sum of the column widths)

make sure to put TechID on the form too -- and make sure the NAME
property is also TechID so this example will work right (you can set the
visible property to No since you do not need it to show)

once the form for TechTasks is created:

from the design view of the main form

create a subform control on you main form using the toolbox (Cancel the
wizard if it pops up and fill properties manually)

1. turn on the properties window
(r-click anywhere and choose Properties from the shortcut menu)

2. click ONE time on the subform control if it is not already selected

3. click on the DATA tab of the Properties window

SourceObject --> drop list and choose the name of the form you will use
as a subform (the form based on TechTasks)

LinkMasterFields --> TechID
LinkChildFields --> TechID

where TechID is an autonumber field (usually) in the parent table and a
Long Integer field in the child table

the link field properties actually use controls, not fields -- so the
controls you reference must be ON each of the respective forms and the
NAME property is what you need to reference -- if a control is bound, I
usually make the Name of the control the same as the ControlSource (what
is in it)

It is common to set the Visible property to No for the control(s) used
in LinkChildFields

then, while still on the subform control, click the ALL tab -- change
the Name property to match the SourceObject property (minus Form. in the
beginning if Access puts it there)

*** Difference between Subform Control and Subform ***

The first click on a subform control puts handles* around the subform
object.
*black squares in the corners and the middle of each size -- resizing
handles

The subform object has properties such as

Name
SourceObject
LinkMasterFields
LinkChildFields
Visible
Locked
Left
Top
Width
Height

the subform control is just a container for the subform.

the subform itself is an independent form -- you can open it directly
from the database window and it has the same properties of the main
form. It is only called a subform because of the way it is being used.

To summarize, when you are in the design view of the main form, the
first click on the subform is the subform control -- you will see the
handles around the edges -- and the second click gets you INTO it -- you
will see a black square where the rulers intersect in the upper left of
the "form" you are "in" (and this is the same as if you went to the
design directly)

me.subform.controlname --> the subform control
me.subform.controlname.form --> the form inside the subform control

Personally, I edit subforms directly, not from inside the main form -- I
have had trouble with Access putting property changes in the wrong place
for RowSources and RecordSource. Since it happens there occassionally,
for major changes, I go to the design view of the "sub"form directly
from the databse window when the main form is closed.

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
G

Guest

I'm reading the first set of directions, and under the *TechTasks*, it says,
"TechID, long integer--FK to Technicians table" and then "TechID, long
integer--FK to Tasks table". Can you tell me what "FK" means?

More questions likely to follow.
 
S

strive4peace

Hi Joe,

sorry, FK is Foreign Key. That means you will have a field that can be
used to locate a record in another table and join to its information

for better understanding, download and read this:

Access Basics
http://allenbrowne.com/casu-22.html
This 30-page training tutorial will orient you toward the core concepts
of Microsoft Access

then, of course, post back with your questions

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
G

Guest

Is there a way I can use the existing form (mentioned in my first email) with
the tables you had suggested, or would I basically have to start from
scratch?
 
S

strive4peace

Access Basics
---


Hi Joe,

I would be doing you a disservice if I helped you build on sand
....sorry, but you would only regret it in the future when the problems
start compounding ... you are already seeing them -- and you wouldn't
have the current problem if your data were structured properly

It is not so hard (comparitively <smile>) -- seperate the data now while
you are still in the beginning... (you'll be thankful later, believe me)

for better understanding, download and read this:

Access Basics
http://allenbrowne.com/casu-22.html
This 30-page training tutorial will orient you toward the core concepts
of Microsoft Access

It is best to start again -- not from scratch -- you already have more
than a glimpse of what you need


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top