well, you could split the Workout table into a Workout table with a child
WorkoutExercises table - but i can't see much sense in that if the Workout
table's only common field will be the workout date field. you'd still have
the same number of fields in the child table, just replacing the date field
with a foreign key field linking back to the Workout table. it just adds an
unnecessary layer to your tables/relationships.
instead, suggest you keep the tables structure as is, and add an unbound
textbox control to frmClients, i'll call it txtWorkoutDate. enter the date
you want to see/add workout records for. add the txtWorkoutDate to the
subform control's LinkMasterFields property, and add the workout date field
name (from the workouts table) to the LinkChildFields property. by changing
the date in the textbox, you'll change the records returned by the subform.
also, you can add a Default value to the date control in the subform, as
=[Forms]![frmClients]![txtWorkoutDate]
so when you *add* a new record to the subform, it will automatically have
the date entered in the txtWorkDate control in the mainform.
the above will work for the form/subform setup i outlined in my previous
post. i'm not sure what you mean by
I have a command button on a "switchboard" that opens my frmClient. When
I
Click this button I want to open a new form, how do i tell it to do that?
the command button opens frmClient. what "new form" do you want to open?
instead of frmClient? in addition to frmClient? please explain.
I then want to be able to EDIT that particular workout later if needed by
creating a command button called "edit workout". when i click this
command
button i want it to ask me for which client(list box), then whick workout
date (list box).
well, in the form/subform setup i proposed, you CAN edit any existing
workout record anytime you want, as well as adding a workout record anytime
you want. if instead you want a form simply to add/edit client records, and
a separate form to add/edit workout records for specific clients/dates, you
can do that pretty much as you proposed - with an unbound listbox with
RowSource based on the clients table, and an unbound listbox of dates with
RowSource based on a SELECT DISTINCT query of the date field of the workout
table, and filtering the workouts form's RecordSource with the values chosen
in those two controls. though having a listbox of dates might be somewhat
trickier from the standpoint of entering new records in the form with a date
that was not yet in the date listbox - you'd want to requery the listbox at
some point, and some issues might arise; i'd have to work through it with a
test setup to really discover the ins and outs of making it work.
hth
Tina, I could use a little more help.
I have made the changes as you suggested and looks great so far but I am
not
sure where to put my workout date. In my subform I have done as you
suggested below. However, if I put my workout date in this subform and
make
it a continous form it repeats the workout date too. I want to create a
Workout for a specific client and a specific date. then add multiple
exercises for that date. Hope this makes sense.
I have a command button on a "switchboard" that opens my frmClient. When
I
Click this button I want to open a new form, how do i tell it to do that?
I then want to be able to EDIT that particular workout later if needed by
creating a command button called "edit workout". when i click this
command
button i want it to ask me for which client(list box), then whick workout
date (list box).
Thanks so much for all help!
LTOSH
:
you're welcome
thanks allen and tina for guidance on my tables...i will get to work
on
them
probably tomorrow. i may be bck for further help.
thanks again!!
:
a note on your tables design: recommend you remove the Exercise
Name
field
from the Workout table. that value is already stored in the
Exercises
table,
which is linked to the Workout table by the ExerciseID foreign key
field, so
storing it again violates normalization rules. and if the
Description
field
in the Workout table is the same as the Description field in the
Exercises
table, then remove it from the Workout table too, for the same
reason.
and,
btw, recommend you remove any spaces from your fieldnames - Exercise
name
should be ExerciseName; for more information, see
http://home.att.net/~california.db/tips.html#aTip5.
once you've made the correction(s) above, suggest the following for
your
data entry forms: create a form bound to the Client table,
SingleForm
view,
i'll call it frmClients. create another form bound to the Workout
table,
Datasheet view, i'll call it sfrmWorkouts. in sfrmWorkouts, add a
combobox
control, and set the ControlSource to ExerciseID; set the RowSource
to a
SQL
statement, as
SELECT ExerciseID, ExerciseName FROM Exercises;
set the following combobox properties, as
ColumnCount: 2
ColumnWidths: 0"; 1"
BoundColumn: 1
LimitToList: Yes
when you look at the combobox droplist in Form view (Datasheet view,
in
this
case), you'll see only the exercise name, but when you pick an
exercise
from
the list, the ExerciseID will be saved in the field in the Workout
table, as
it should be.
add sfrmWorkouts to the frmClients, as a subform. set the subform's
LinkChildFields property to ClientID (which refers to the foreign
key
field
in the Workout table), and set the LinkMasterFields property to
ClientID
(which refers to the primary key field in the Client table).
so now you can open the mainform (frmClients), and add a new client
record
or go to an existing client record, and then - in the subform -
choose
an
exercise from the combobox droplist and enter the date, sets, reps,
and
weight; enter as many exercise records as you want for each client.
hth
(Using Access 2000)
I have a 3 tables.
Client Table...ClientID(pk), first name, last name, address etc.
Exercises Table...ExerciseID(pk), exercise name, description etc
Workout Table...WorkoutID(pk), ClientID, ExerciseID, workout date,
Exercise
Name, sets, reps, weight, description.
I am wanting to create a form where i can choose a client (combo
box),
type
in the workout date, then create a workout. I want to save this
workout
specific to the client name. Where do i begin?
Thanks!