Hope someone can help me here.
I am fairly new to Access. I have set up a database relating to vehicle
movements prior to sale. I have a subform based on 'locations' table
which is linked to my main 'vehicles' tables through vehicleID.
Table 'Locations' has the following fields; LOcationID(PK), VehicleID,
Location, DateDueIn, ActualDateIN, DateDueOut, ActualDateOut.
I have set up form validation rules so that no dates can be entered
unless a location is present, Actualdatein cannot be entered unless
duedatein is entered. Datedueout cannot be entered unless actualdatein
is entered and actualdateout cannot be entered unless datedueout is
entered.
Vehicles can have up to 4 or 5 movements to various locations. However,
how it is set up at the moment, nothing prevents me from entering a
second record even though the first record has not been fully
completed. For example record one can show location and the first three
dates completed, but no date out entered. I can then create a new
record which can show an actual date in and therefore the vehicle shows
as being in 2 locations at the same time as record one does not have an
actual date out!!
Is there a way to prevent creation of a second record until all the
fields in record one are filled in or can someone suggest a better way
of solving this.
Hope this makes sense !
Thanks
Terry
MGFoster - 24 Jan 2006 00:18 GMT
In the Location form's BeforeUpdate event run a query that checks for
any missing Actual Date Out for the current record's Vehicle ID (make
sure you don't include the current record in the check). If there are
any other records that have a NULL Actual Date Out then set Cancel =
True & the current record won't be saved. You can add a MsgBox to
inform the user of what went wrong.

Signature
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
> Hope someone can help me here.
>
[quoted text clipped - 23 lines]
> fields in record one are filled in or can someone suggest a better way
> of solving this.