subform datasheet

  • Thread starter Thread starter macamarr
  • Start date Start date
M

macamarr

Hello, thanks in advance for any help/suggestions you may
have.

My form is used to input starting and ending mileage for
vehicles used on a given day. The parent form is used for
the vehicle information and the child form is used to
input information for keeping track of the mileage and
some other misc info. I used to have this done on a
spreadsheet, but the person doing the input just could
not get it right so I decided to go with access and use a
form for the entry of information. Here is my problem. I
want to tell the starting mileage textbox that it can't
have a number that is less than the last entry made in
the ending mileage textbox.
 
In design view in the subform, assuming that the beginning mileage is
entered first, you can set the Validation Rule for the Ending_Mileage
textbox to "> Beginning_Mileage". Set the Validation Text to "Must be more
than Beginning_Mileage" (without the quotes).

HTH,

joemach
 
that works great, Thank You! Now is there a way to
prevent the next Beginning_Mileage from being < than the
last entered Ending_Mileage ?
 
Deepening on if vehicle is only used for one purpose you could use a
TOP SELECT Query to feed a value to the new Beginning_Mileage.
It could be locked if the Ending_Mileage of one record will always be the
Beginning_Mileage of the next record.

Let me know if this won't work for you,

joemach
 
Actually, I think he's looking for the
Beginning_Mileage to be greater than the Endig_Mileage of
the PREVIOUS record. I have this same sort of conundrum
purchase dates of properties: "Purchase date of current
property owner cannot be before Sold date of prior
property owner".
I can't find the code right now, but as I recall, I
did something in the OnLostFocus event that created a
recordset of all records for the property, sorted them by
Sold date, then checked the previous record's Sold date
against the current record's Purchase date.
It may be rather kludgy because I'm new at this, but
it seemed to work for me. Good luck, and I'll follow
this to see if there is a more elegant way!
Jon Mulder, Durham CA
 
Back
Top