set default values

  • Thread starter Thread starter Walter
  • Start date Start date
W

Walter

How do I set the default value of a control to the value
of a field in a previous record where the value of other
controls meet specific criteria? One criteria control is
on the main form and another is on a subform with the
value control.
Thanks,
Walter
 
I am trying to automatically enter data when
appropriate. If the Truck # on the main form is 1 and
the last "State Line" was CA, then the state for each new
record would be CA until the next "State Line" entry.
This requires selecting the maximum odometer entry where
the truck # = the number selected and the odometer
description = "State Line". I can create the query and
set the criteria for the Truck # and Odometer Description
but I haven't been able define the criteria to select the
maximum odometer. Also, I haven't been able to figure
out how to get the results into the control.
Thanks for your help.
Walter
 
Thanks for the info. I figured out how to select the
specific record from this article but I have yet to
figure out how to get it displayed in my controls. One
control is is used for entering data with the control
source as the appropriate field name. I would like to
set the default value of this control to the value
returned by the query. Three other controls are text
boxes just to display the values returned by the query.
I tried setting the control source to the field in the
query and doing a requery on the control in the
AfterUpdate event of the criteria control but I am still
getting ?Name. I also have one data entry control where
I would like to use a query's result as the validation
rule(>=query result). I have been unable to find
information that addresses this subject and all my
efforts have failed. Any guidance in this matter would
be greatly appreciated.
Thanks again for your help.
Walter
 
Instead of trying to assign a default value, how about putting some code
into the BeforeInsert event of the form. It will then run the code -
probably an OpenRecordset() - and assign the values at the moment a user
begins adding a new record.
 
Back
Top