indyscott Posted November 3, 2005 Posted November 3, 2005 Hello all, I have been trying to make a small car rental program so that everytime I rent a certain car the mileage will always be correct. The car info is kept in a seperate file and I use the lookup function to pull over the Car Number, Plate, Yr, make etc,, but when I pull the starting mileage over I want it to be the ending mileage of the previous rental. I dont want the starting mileage to change on the rental form when inputting the mileage in. I hope this make sense. Thanks in advance.
mr_vodka Posted November 3, 2005 Posted November 3, 2005 You can sort your related rental history for that specific CarID and then take the last record's value from the EndMileage and set it to a the new record's StartMileage.
indyscott Posted November 3, 2005 Author Posted November 3, 2005 Thanks Mr_vodka I will give it a try. I didn't think about it that way. Scott
Oldfogey Posted November 4, 2005 Posted November 4, 2005 Wouldn't Max(CarID::EndMileage) work as well but quicker?
mr_vodka Posted November 4, 2005 Posted November 4, 2005 Hi OldFogey, Yes it might be faster. I personally never rely on the Max function to compensate for human typo error but thats a matter of choice. Your solution is just as fine.
comment Posted November 4, 2005 Posted November 4, 2005 I don't see how Max ( related::Field ) would be faster than Last ( related::Field ), especially when Field is not indexed.
indyscott Posted November 4, 2005 Author Posted November 4, 2005 Thanks for your input. I am new to this so it will take some experimentation to get it right. Any help is appreciated. Scott B)
Recommended Posts
This topic is 7220 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now