selection only one tick box

stu_c

Registered User.
Local time
Today, 02:15
Joined
Sep 20, 2007
Messages
494
Hi all
bit of a strange request, I have got two tables with a tick Box in each named.

TBLBooking
[Available]

TBLVehicle
[InForRepair]

what I want to do is when one is ticked the other is unticked, can someone point me in the direction on how to do this?
 
Use the following assuming these are the field/control names

Code:
Me.Available= Not Me.InForRepair
 
would have thought you only need the one tickbox - the inforrepair one.

If it is ticked then it is not available, if unticked, it is

The fact you say these are in different tables suggests to me that your table structure is not correct
 
Hello CJ
here is the issue, we have a several tables
TBLFleetVehicles - all the vehicle details
TBLWorkshops - All Vehicles Currently in for Repair
TBLBookings - All vehicles booked out

what I was planning to do is do it so a vehicle in workshops cannot be booked but struggling to find the best way to do it. I was going to use a Query but its not liking Bookings and workshops tables in the same query
 
Not sure how your tables are constructed, but something like

Code:
SELECT TF.*
FROM (TBLFleetVehicles TF LEFT JOIN TBLWorkshops TW ON TF.VehiclePK=TW.VehicleFK) LEFT JOIN TBLBookings TB ON TF.VehiclePK=TB.VehicleFK
WHERE TW.VehicleFK is Null AND =TB.VehicleFK is Null

will show only those vehicles that are not booked or being repaired. Note the use of Aliasing (TF,TB, TW) to make the code easier to read.

It will no doubt need refining for dates unless these tables only contain the current situation

But I would also suggest your workshops and bookings table would be the same table - something like

tblUsage
UsagePK autonumber
VehicleFK long
Usage text or Boolean (to mean booked or repair)
UsageFrom date
UsageTo date

then for more information on booking the booking table would have a FK to the UsagePK (so would not need the vehicleFK or date fields) and the same for the repairs table
 
Hello CJ
here is the issue, we have a several tables
TBLFleetVehicles - all the vehicle details
TBLWorkshops - All Vehicles Currently in for Repair
TBLBookings - All vehicles booked out

what I was planning to do is do it so a vehicle in workshops cannot be booked but struggling to find the best way to do it. I was going to use a Query but its not liking Bookings and workshops tables in the same query

TBLWorkshops and TBLBookings seem to be redundant.

You should have one table that indicates what vehicles you have.
You should have one table that says where those vehicles are. Being "Booked" or being "Workshop" should be entries in your "WheresMyCar" table. That table would hold date/time a vehicle goes (or is scheduled to go) some place as well as an estimate on return. This will allow you to track what is where when for all vehicles in the fleet, even those that are not available because they are "In transport" or other unavailable statuses.

Most current record also shows what is/isn't available and the estimate on return date/time can be used for future bookings.
 

Users who are viewing this thread

Back
Top Bottom