PC Review


Reply
Thread Tools Rate Thread

display an entry from a previous record

 
 
=?Utf-8?B?SmVu?=
Guest
Posts: n/a
 
      21st Apr 2006
I track vehicle mileage on all our work vehicles. I have been creating
double entries by entering beginning and ending. How would I create a box to
display the ending mileage from the previous record?

Now my vehicles are sorted by numbers ... unit 12, 21, 22 etc. and how would
I want to create tables to track these? Currently I use one table to track
all vehicles.

Thanks Jen
 
Reply With Quote
 
 
 
 
butboris via AccessMonster.com
Guest
Posts: n/a
 
      21st Apr 2006
Hi jen,
If I understand you correctly, it sounds like your table structure needs some
work.
I think you need two tables, one for vehicles and one for milages, the
relationships would be one vehicle to many milages.
Make the milages a continuous sub-form and place this code into the "after-
update" event of the end milage text box on the form. Change the names to
whatever the names are that you are using.

Private Sub EndTextboxname_AfterUpdate()
Me.Begintextboxname.DefaultValue = """" & Me.EndTextboxname.Value & """"
End Sub

Hope this helps

Jen wrote:
>I track vehicle mileage on all our work vehicles. I have been creating
>double entries by entering beginning and ending. How would I create a box to
>display the ending mileage from the previous record?
>
>Now my vehicles are sorted by numbers ... unit 12, 21, 22 etc. and how would
>I want to create tables to track these? Currently I use one table to track
>all vehicles.
>
>Thanks Jen


--
Message posted via http://www.accessmonster.com
 
Reply With Quote
 
butboris via AccessMonster.com
Guest
Posts: n/a
 
      21st Apr 2006
Hi jen,
If I understand you correctly, it sounds like your table structure needs some
work.
I think you need two tables, one for vehicles and one for milages, the
relationships would be one vehicle to many milages.
Make the milages a continuous sub-form and place this code into the "after-
update" event of the end milage text box on the form. Change the names to
whatever the names are that you are using.

Private Sub EndTextboxname_AfterUpdate()
Me.Begintextboxname.DefaultValue = """" & Me.EndTextboxname.Value & """"
End Sub

Hope this helps

Jen wrote:
>I track vehicle mileage on all our work vehicles. I have been creating
>double entries by entering beginning and ending. How would I create a box to
>display the ending mileage from the previous record?
>
>Now my vehicles are sorted by numbers ... unit 12, 21, 22 etc. and how would
>I want to create tables to track these? Currently I use one table to track
>all vehicles.
>
>Thanks Jen


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...dules/200604/1
 
Reply With Quote
 
butboris via AccessMonster.com
Guest
Posts: n/a
 
      21st Apr 2006
Hi jen,
If I understand you correctly, it sounds like your table structure needs some
work.
I think you need two tables, one for vehicles and one for milages, the
relationships would be one vehicle to many milages.
Make the milages a continuous sub-form and place this code into the "after-
update" event of the end milage text box on the form. Change the names to
whatever the names are that you are using.

Private Sub EndTextboxname_AfterUpdate()
Me.Begintextboxname.DefaultValue = """" & Me.EndTextboxname.Value & """"
End Sub

Hope this helps

Jen wrote:
>I track vehicle mileage on all our work vehicles. I have been creating
>double entries by entering beginning and ending. How would I create a box to
>display the ending mileage from the previous record?
>
>Now my vehicles are sorted by numbers ... unit 12, 21, 22 etc. and how would
>I want to create tables to track these? Currently I use one table to track
>all vehicles.
>
>Thanks Jen


--
Message posted via http://www.accessmonster.com
 
Reply With Quote
 
butboris via AccessMonster.com
Guest
Posts: n/a
 
      21st Apr 2006
Appologies for the triple entry, my fault!!

butboris wrote:
>Hi jen,
>If I understand you correctly, it sounds like your table structure needs some
>work.
>I think you need two tables, one for vehicles and one for milages, the
>relationships would be one vehicle to many milages.
>Make the milages a continuous sub-form and place this code into the "after-
>update" event of the end milage text box on the form. Change the names to
>whatever the names are that you are using.
>
>Private Sub EndTextboxname_AfterUpdate()
>Me.Begintextboxname.DefaultValue = """" & Me.EndTextboxname.Value & """"
>End Sub
>
>Hope this helps
>
>>I track vehicle mileage on all our work vehicles. I have been creating
>>double entries by entering beginning and ending. How would I create a box to

>[quoted text clipped - 5 lines]
>>
>>Thanks Jen


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...dules/200604/1
 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      21st Apr 2006
I agree with the previous responder, but I do have an alternative to using a
subform to display the previous entries in the milage table. You could look
up the previous ending milagde for the vehiclde in the form's Current event
and put it in the beginning milage control on your form using the DMax
function:

Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = " _
& Me.txtVehicleID),0)

As to having a table for each vehicle - BBBBAAAADDDD IIIIDDDDEEEEAAAA!!!!

"Jen" wrote:

> I track vehicle mileage on all our work vehicles. I have been creating
> double entries by entering beginning and ending. How would I create a box to
> display the ending mileage from the previous record?
>
> Now my vehicles are sorted by numbers ... unit 12, 21, 22 etc. and how would
> I want to create tables to track these? Currently I use one table to track
> all vehicles.
>
> Thanks Jen

 
Reply With Quote
 
=?Utf-8?B?SmVu?=
Guest
Posts: n/a
 
      19th May 2006
I have changed my tables to match what you typed renamed the fields and still
can not get this code to work. It highlights the following as an
error...........HELP

& Me.txtVehicleID),0)



"Klatuu" wrote:

> I agree with the previous responder, but I do have an alternative to using a
> subform to display the previous entries in the milage table. You could look
> up the previous ending milagde for the vehiclde in the form's Current event
> and put it in the beginning milage control on your form using the DMax
> function:
>
> Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = " _
> & Me.txtVehicleID),0)
>
> As to having a table for each vehicle - BBBBAAAADDDD IIIIDDDDEEEEAAAA!!!!
>
> "Jen" wrote:
>
> > I track vehicle mileage on all our work vehicles. I have been creating
> > double entries by entering beginning and ending. How would I create a box to
> > display the ending mileage from the previous record?
> >
> > Now my vehicles are sorted by numbers ... unit 12, 21, 22 etc. and how would
> > I want to create tables to track these? Currently I use one table to track
> > all vehicles.
> >
> > Thanks Jen

 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      19th May 2006
This is all one line. The _ at the end of the first line is just a line
continuation code. If it fits on one line in your code window, remove it.

Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = " _
& Me.txtVehicleID),0)

Also, this code assumes [VehicleID] is a numeric field in Milage Table. If
it is a text field, you need to enclose Me.txtVehicleID in single quotes like
this:

Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = '" _
& Me.txtVehicleID) & "'",0)

"Jen" wrote:

> I have changed my tables to match what you typed renamed the fields and still
> can not get this code to work. It highlights the following as an
> error...........HELP
>
> & Me.txtVehicleID),0)
>
>
>
> "Klatuu" wrote:
>
> > I agree with the previous responder, but I do have an alternative to using a
> > subform to display the previous entries in the milage table. You could look
> > up the previous ending milagde for the vehiclde in the form's Current event
> > and put it in the beginning milage control on your form using the DMax
> > function:
> >
> > Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = " _
> > & Me.txtVehicleID),0)
> >
> > As to having a table for each vehicle - BBBBAAAADDDD IIIIDDDDEEEEAAAA!!!!
> >
> > "Jen" wrote:
> >
> > > I track vehicle mileage on all our work vehicles. I have been creating
> > > double entries by entering beginning and ending. How would I create a box to
> > > display the ending mileage from the previous record?
> > >
> > > Now my vehicles are sorted by numbers ... unit 12, 21, 22 etc. and how would
> > > I want to create tables to track these? Currently I use one table to track
> > > all vehicles.
> > >
> > > Thanks Jen

 
Reply With Quote
 
=?Utf-8?B?SmVu?=
Guest
Posts: n/a
 
      19th May 2006
I double checked and they are listed as numerical but I have been entering
the code under Form AfterUpdate. Is this where I should list it?



"Klatuu" wrote:

> This is all one line. The _ at the end of the first line is just a line
> continuation code. If it fits on one line in your code window, remove it.
>
> Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = " _
> & Me.txtVehicleID),0)
>
> Also, this code assumes [VehicleID] is a numeric field in Milage Table. If
> it is a text field, you need to enclose Me.txtVehicleID in single quotes like
> this:
>
> Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = '" _
> & Me.txtVehicleID) & "'",0)
>
> "Jen" wrote:
>
> > I have changed my tables to match what you typed renamed the fields and still
> > can not get this code to work. It highlights the following as an
> > error...........HELP
> >
> > & Me.txtVehicleID),0)
> >
> >
> >
> > "Klatuu" wrote:
> >
> > > I agree with the previous responder, but I do have an alternative to using a
> > > subform to display the previous entries in the milage table. You could look
> > > up the previous ending milagde for the vehiclde in the form's Current event
> > > and put it in the beginning milage control on your form using the DMax
> > > function:
> > >
> > > Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = " _
> > > & Me.txtVehicleID),0)
> > >
> > > As to having a table for each vehicle - BBBBAAAADDDD IIIIDDDDEEEEAAAA!!!!
> > >
> > > "Jen" wrote:
> > >
> > > > I track vehicle mileage on all our work vehicles. I have been creating
> > > > double entries by entering beginning and ending. How would I create a box to
> > > > display the ending mileage from the previous record?
> > > >
> > > > Now my vehicles are sorted by numbers ... unit 12, 21, 22 etc. and how would
> > > > I want to create tables to track these? Currently I use one table to track
> > > > all vehicles.
> > > >
> > > > Thanks Jen

 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      19th May 2006
Actually, I think I gave bad advice, rather than the DLoookup, I think what
you need is DMax, which will return the highest value. The DLookup would
return the first record it finds, which would probably not be the correct
record.

I would suggest you put it in the Control Source property of txtBeginMiles
like this (Note it needs the actual form name here, Me. will not work in this
situation):

=DMax("[EndMiles]", "MilageTable", "[VehicleID] = " & Me.txtVehicleID),0)

"Jen" wrote:

> I double checked and they are listed as numerical but I have been entering
> the code under Form AfterUpdate. Is this where I should list it?
>
>
>
> "Klatuu" wrote:
>
> > This is all one line. The _ at the end of the first line is just a line
> > continuation code. If it fits on one line in your code window, remove it.
> >
> > Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = " _
> > & Me.txtVehicleID),0)
> >
> > Also, this code assumes [VehicleID] is a numeric field in Milage Table. If
> > it is a text field, you need to enclose Me.txtVehicleID in single quotes like
> > this:
> >
> > Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = '" _
> > & Me.txtVehicleID) & "'",0)
> >
> > "Jen" wrote:
> >
> > > I have changed my tables to match what you typed renamed the fields and still
> > > can not get this code to work. It highlights the following as an
> > > error...........HELP
> > >
> > > & Me.txtVehicleID),0)
> > >
> > >
> > >
> > > "Klatuu" wrote:
> > >
> > > > I agree with the previous responder, but I do have an alternative to using a
> > > > subform to display the previous entries in the milage table. You could look
> > > > up the previous ending milagde for the vehiclde in the form's Current event
> > > > and put it in the beginning milage control on your form using the DMax
> > > > function:
> > > >
> > > > Me.txtBeginMiles = Nz(DLookup("[EndMiles]", "MilageTable", "[VehicleID] = " _
> > > > & Me.txtVehicleID),0)
> > > >
> > > > As to having a table for each vehicle - BBBBAAAADDDD IIIIDDDDEEEEAAAA!!!!
> > > >
> > > > "Jen" wrote:
> > > >
> > > > > I track vehicle mileage on all our work vehicles. I have been creating
> > > > > double entries by entering beginning and ending. How would I create a box to
> > > > > display the ending mileage from the previous record?
> > > > >
> > > > > Now my vehicles are sorted by numbers ... unit 12, 21, 22 etc. and how would
> > > > > I want to create tables to track these? Currently I use one table to track
> > > > > all vehicles.
> > > > >
> > > > > Thanks Jen

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basing one data entry form on a previous record Josh Microsoft Access 6 10th Dec 2008 12:29 AM
automatic entry of previous record Bill Microsoft Access Database Table Design 1 4th Nov 2008 09:29 PM
Copying from previous record entry Stiruchi Microsoft Access Form Coding 3 22nd Sep 2008 04:35 PM
Create a repeat entry key for data on previous record =?Utf-8?B?Vmlja2llIEAgSUZDTw==?= Microsoft Access 2 2nd May 2006 09:18 PM
Using Previous Record For Data Entry =?Utf-8?B?TW9vbGlpQmV0aA==?= Microsoft Access Forms 6 30th Jul 2005 01:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:30 PM.