Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get information fron other record ? 1

Status
Not open for further replies.

sippe

Technical User
Jun 24, 2004
10
FI
Hello

I have access program, where is many fields...
Everything else I can handle but copying field information from the record to next.

I have fields start and end, which include kilometers. I should copy info from end field to next records start field automatically when you take new record.

Is it possible and if it is how ?

I haven't used VBA before, but I'm studying it...

I'm gratefull if somebody could help me...

Sippe
 
Sorry, should have added, assign value of the variable to the start number in the form's OnCurrent event.

The Missinglinq

"It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
Thinking this is kind of, well not a running sum, but having kilometes like this:
[tt]
Start End
100 110
110 125
125 155
155 175...[/tt]

First, this is how one probably would have done it in Excel, but I'm inclined to think it might be redunancy in a database. Wouldn't it suffice with only the End kilometres per record?

Unless one provides means for Access to know what was "the last or previous record", one couldn't be to sure what was put in the DefaultValue property or the form public (what would happen if you needed to alter some of the previous values?). Perhaps a more reliable method would be to fetch the highest value and assign it to the "Start" control. Though I don't use the domain aggregate functions, as an example perhaps:

[tt]if isnull(me("txtStart").value) then
me("txtStart").value = dmax("EndKm","yourtable")
end if[/tt]

- assuming the control holding the start kilometer is named "txtStart" and the table field holding the end kilometer is named "EndKm". If this table contains kilometres for more than one vehicle/person, then perhaps also a criteria?

[tt]dmax("EndKm","yourtable","vehiclenr = " & me("txtVehiclenr").value)[/tt]

- assuming a form control holding a numeric value identifiating a vehicle.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top