passing a value of one field to a field on a subform

D

DawnTreader

Hello

i have 2 tables that are related. one of those tables has a "subtable".

the main table, UNITS is a record of all the machines we sell. the related
table is SERVICEREPORTS. each UNIT can have many SERVICEREPORTS.

UNITS has a 'subtable' called RUNNINGHOURS. in my forms i have a main form
for entering everything pertaining to the UNITS, including a subform for
putting in the RUNNINGHOURS at specific dates.

when a technician fills in the SERVICEREPORTS there is a place where they
are to put in the DATE of the service. there is also a spot to put in the
DATE of the RUNNINGHOURS.

these 2 dates are only related in that on the same day the technician
creates a service report and the running hours on the machine are known.

in my service report form i am using a subform to put in the hours for the
UNIT's current RUNNINGHOURS. i need to pass the SERVICEREPORT DATE to the
RUNNINGHOURS DATE so that there is no need for the technician to enter the
same date twice.

does this make sense, and is there a way to make the date entered on my
service report form, pass to the running hours subform and therefore into the
table?
 
T

Terry

Try passing the entered date in SERVICEREPORT DATE to RUNNINGHOURS DATE by
using the AfterUpdate event for SERVICEREPORT DATE.

If RUNNINGHOURS DATE is on the subform, then use

Me.subFormNameHere![SERVICEREPORT DATE] = Me.[SERVICEREPORT DATE]

Regards
Terry
 
D

DawnTreader

Hello

i think i see a small error in your code, shouldnt SERVICEREPORT DATE be
RUNNINGHOURS DATE?

Me.subFormNameHere![RUNNINGHOURS DATE] = Me.[SERVICEREPORT DATE]

because the first part is the field on the subform right?

Terry said:
Try passing the entered date in SERVICEREPORT DATE to RUNNINGHOURS DATE by
using the AfterUpdate event for SERVICEREPORT DATE.

If RUNNINGHOURS DATE is on the subform, then use

Me.subFormNameHere![SERVICEREPORT DATE] = Me.[SERVICEREPORT DATE]

Regards
Terry

DawnTreader said:
Hello

i have 2 tables that are related. one of those tables has a "subtable".

the main table, UNITS is a record of all the machines we sell. the related
table is SERVICEREPORTS. each UNIT can have many SERVICEREPORTS.

UNITS has a 'subtable' called RUNNINGHOURS. in my forms i have a main form
for entering everything pertaining to the UNITS, including a subform for
putting in the RUNNINGHOURS at specific dates.

when a technician fills in the SERVICEREPORTS there is a place where they
are to put in the DATE of the service. there is also a spot to put in the
DATE of the RUNNINGHOURS.

these 2 dates are only related in that on the same day the technician
creates a service report and the running hours on the machine are known.

in my service report form i am using a subform to put in the hours for the
UNIT's current RUNNINGHOURS. i need to pass the SERVICEREPORT DATE to the
RUNNINGHOURS DATE so that there is no need for the technician to enter the
same date twice.

does this make sense, and is there a way to make the date entered on my
service report form, pass to the running hours subform and therefore into
the
table?
 
D

DawnTreader

i guess the other thing i didnt mention but probably should, is that the
service form is a subreport as well. would it be treated as a main form
because the running hours form is a subform.

UNITS
SERVICEREPORTS
RUNNINGHOURS

thats the structure of the forms.

Terry said:
Try passing the entered date in SERVICEREPORT DATE to RUNNINGHOURS DATE by
using the AfterUpdate event for SERVICEREPORT DATE.

If RUNNINGHOURS DATE is on the subform, then use

Me.subFormNameHere![SERVICEREPORT DATE] = Me.[SERVICEREPORT DATE]

Regards
Terry

DawnTreader said:
Hello

i have 2 tables that are related. one of those tables has a "subtable".

the main table, UNITS is a record of all the machines we sell. the related
table is SERVICEREPORTS. each UNIT can have many SERVICEREPORTS.

UNITS has a 'subtable' called RUNNINGHOURS. in my forms i have a main form
for entering everything pertaining to the UNITS, including a subform for
putting in the RUNNINGHOURS at specific dates.

when a technician fills in the SERVICEREPORTS there is a place where they
are to put in the DATE of the service. there is also a spot to put in the
DATE of the RUNNINGHOURS.

these 2 dates are only related in that on the same day the technician
creates a service report and the running hours on the machine are known.

in my service report form i am using a subform to put in the hours for the
UNIT's current RUNNINGHOURS. i need to pass the SERVICEREPORT DATE to the
RUNNINGHOURS DATE so that there is no need for the technician to enter the
same date twice.

does this make sense, and is there a way to make the date entered on my
service report form, pass to the running hours subform and therefore into
the
table?
 
D

DawnTreader

Hello

took another look at this and managed to figure out why it wasnt working.

Me.subFormNameHere.Form![SERVICEREPORT DATE] = Me.[SERVICEREPORT DATE]

missed the one .Form thingy.

Terry said:
Try passing the entered date in SERVICEREPORT DATE to RUNNINGHOURS DATE by
using the AfterUpdate event for SERVICEREPORT DATE.

If RUNNINGHOURS DATE is on the subform, then use

Me.subFormNameHere![SERVICEREPORT DATE] = Me.[SERVICEREPORT DATE]

Regards
Terry

DawnTreader said:
Hello

i have 2 tables that are related. one of those tables has a "subtable".

the main table, UNITS is a record of all the machines we sell. the related
table is SERVICEREPORTS. each UNIT can have many SERVICEREPORTS.

UNITS has a 'subtable' called RUNNINGHOURS. in my forms i have a main form
for entering everything pertaining to the UNITS, including a subform for
putting in the RUNNINGHOURS at specific dates.

when a technician fills in the SERVICEREPORTS there is a place where they
are to put in the DATE of the service. there is also a spot to put in the
DATE of the RUNNINGHOURS.

these 2 dates are only related in that on the same day the technician
creates a service report and the running hours on the machine are known.

in my service report form i am using a subform to put in the hours for the
UNIT's current RUNNINGHOURS. i need to pass the SERVICEREPORT DATE to the
RUNNINGHOURS DATE so that there is no need for the technician to enter the
same date twice.

does this make sense, and is there a way to make the date entered on my
service report form, pass to the running hours subform and therefore into
the
table?
 
Top