UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Take Miles From Last Checkin As Current Miles, Office 2007    
 
   
Ohi
post Mar 29 2012, 01:57 PM
Post #1

UtterAccess Addict
Posts: 179
From: Chicago



I'm not sure if i'm in the right section, but basically this is what I'm trying to do.

I'm currently working on a database that is basically a reservation system for some vehicles we use.

The thing I would like to do, I can't figure it out, I'm not even sure it's entirely possible, but I'm sure it has to be. I would like to take the mileage from the last use of the vehicle, and insert it into the new record for the vehicle as the current miles without having to have someone manually enter that information.

My miles table is structured as such:

MileID (PK)
VehicleID (FK - to Vehicle information - basically contains vehicle ID#, vin, plate, etc.)
RequestID (FK - to Request information - who's using the vehicle, when, how long, what purpose)
MilesInDate (date)
MilesIn (number)
MilesOut (number)

I'm assuming i'd have to do on onload event of the form to pull the milesin of the last record, just not entirely sure how to go about it. Any point in the right direction would be extremely helpful!

Also to note:
There's no data in the database except some test data so having to change things now wouldn't be an issue.

I'm also using the coding from this thread/sample for the visual calendar portion of the database: http://www.UtterAccess.com/forum/Ms-Outloo...r-t1969978.html


--------------------
~Jen
Any question I may ask pertains to Office 2007. I usually forget to put that in my posts >.<
Go to the top of the page
 
+
theDBguy
post Mar 29 2012, 02:03 PM
Post #2

Access Wiki and Forums Moderator
Posts: 57,211
From: SoCal, USA



Hi Jen,

There are several ways to get what you want. For starters, take a look at this KB article from MS.

Just my 2 cents... 2cents.gif


--------------------
Go to the top of the page
 
+
Ohi
post Mar 30 2012, 07:36 AM
Post #3

UtterAccess Addict
Posts: 179
From: Chicago



Oh DB, you're my savior as always! I searched, I googled, but if you don't phrase something properly, you're gonna have a hard time finding what you need which is what I was running into.

That looks like it will work for my situation, and I *think* I know how to make it save to my current record. I will test it out and report back.


--------------------
~Jen
Any question I may ask pertains to Office 2007. I usually forget to put that in my posts >.<
Go to the top of the page
 
+
theDBguy
post Mar 31 2012, 07:18 PM
Post #4

Access Wiki and Forums Moderator
Posts: 57,211
From: SoCal, USA



Hi Jen,

Just let us know if you need more help. Good luck!


--------------------
Go to the top of the page
 
+
Ohi
post May 10 2012, 08:59 AM
Post #5

UtterAccess Addict
Posts: 179
From: Chicago



Sorry to bump an old post, but I've just gotten back to working on this, and I still can't wrap my mind around it (figured why post the same question).

I understand the KB article, and it would work perfectly if I wasn't tracking multiple vehicles and the mileage of those multiple vehicles. I just don't know how to get it to work under those circumstances.

I'm dong more research into referring fields from the previous record, but if anyone knows of a solution that could possibly help, please let me know!

Thanks Much!


--------------------
~Jen
Any question I may ask pertains to Office 2007. I usually forget to put that in my posts >.<
Go to the top of the page
 
+
theDBguy
post May 10 2012, 09:57 AM
Post #6

Access Wiki and Forums Moderator
Posts: 57,211
From: SoCal, USA



Hi Jen,

You might consider posting a zip copy of your db with test data.

Just my 2 cents... 2cents.gif


--------------------
Go to the top of the page
 
+
Ohi
post May 10 2012, 10:48 AM
Post #7

UtterAccess Addict
Posts: 179
From: Chicago



Sure thing...

There may be some errors because I took out a lot of the unnecessary forms and such.

I also had to revert back to an older version where the test data was. Some changes were made but it should basically be the same.

I just don't know how to approach this issue.
Attached File(s)
Attached File  TestShield.zip ( 189.2K ) Number of downloads: 3
 


--------------------
~Jen
Any question I may ask pertains to Office 2007. I usually forget to put that in my posts >.<
Go to the top of the page
 
+
theDBguy
post May 10 2012, 12:46 PM
Post #8

Access Wiki and Forums Moderator
Posts: 57,211
From: SoCal, USA



Hi Jen,

Is this what you mean? Check out the query "theDBguy."

Just my 2 cents... 2cents.gif
Attached File(s)
Attached File  TestShield.zip ( 171.94K ) Number of downloads: 9
 


--------------------
Go to the top of the page
 
+
Ohi
post May 10 2012, 01:56 PM
Post #9

UtterAccess Addict
Posts: 179
From: Chicago



That's exactly what I mean! Thank you so much! notworthy.gif

Now I just have to figure out how to get it to auto pop my data entry on my form. dunce.gif

I'm sure I can figure it out with more digging.

Thank you again!


--------------------
~Jen
Any question I may ask pertains to Office 2007. I usually forget to put that in my posts >.<
Go to the top of the page
 
+
theDBguy
post May 10 2012, 02:08 PM
Post #10

Access Wiki and Forums Moderator
Posts: 57,211
From: SoCal, USA



Hi Jen,

yw.gif

Let us know if you need more help. Good luck with your project.


--------------------
Go to the top of the page
 
+
gemmathehusky
post May 12 2012, 07:37 PM
Post #11

UtterAccess VIP
Posts: 2,540
From: UK



a serious question, though is WHY do you think it is important to obtain the last odo reading.

when you come to select fuel fills (say) for a range of dates, at that point you will have all the readings available.

the point is, that concepts like previous and next records are not intrinsic to databases, and often we can achieve what we want without doing this. We often need to avoid spreadsheet thinking.

eg - let's say you DO look up the previous record, to get the last ODO reading. YOu ALSO need to look up the next record, and see if that one made previous reference to the one you have just found.

ie - you are assuming you are adding a record at the end of a sequence, but that is not necessarily so. you may have an old record that you need to insert in the middle of a sequence. you also need to consider what happens if you delete a record, as again, the next/previous records are both affected.

by not bothering to get the previous record, and using another method, you avoid all these problems.


--------------------
Dave (Male)

(Gemma was my dog)
Go to the top of the page
 
+
Ohi
post Jun 1 2012, 07:54 AM
Post #12

UtterAccess Addict
Posts: 179
From: Chicago



I don't think it's important to obtain the last odo reading, for my end users the data is important.

I realized I do not need to save them, because that's unnecessary, and I can do what I need to do via queries.

They need to know how many miles were driven during the vehicle's use, this would accomplish that, and it has.

I understand where you were going and I thank you for your input!


--------------------
~Jen
Any question I may ask pertains to Office 2007. I usually forget to put that in my posts >.<
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Search  ·  Go to Top  ·  Lo-Fi Version Time is now: 23rd July 2014 - 11:06 AM