Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Query previous record for form control

Can not seem to find how to return data from the previous record to us with an unbound form control like I would have done using MS ACCESS

My table of trip records. tblTrips contains fields for previous accommodation, depart date, time and odometer etc. Also arrive accommodation, arrive date, time and odometer. Then depart details for calculating length of stay, kilometres travelled while at accommodation, cost etc using a query.

Surely it would be more efficient to return the previous record details rather than enter them again and store them again. Being able to use data from the previous record for calculations in a query would mean less typing and data space. Hope I have explained things sufficiently.

In access it was something like SELECT ID, AccomName, Address, depart date etc FROM tblTrips WHERE (TripID = forms!frmTrips.TripID -1) ORDER BY TripID

How can I achieve this.

Cheers,

Mike

Query previous record for form control

Can not seem to find how to return data from the previous record to us with an unbound form control like I would have done using MS ACCESS

My table of trip records. tblTrips contains fields for previous accommodation, depart date, time and odometer etc. Also arrive accommodation, arrive date, time and odometer. Then depart details for calculating length of stay, kilometres travelled while at accommodation, cost etc using a query.

Surely it would be more efficient to return the previous record details rather than enter them again and store them again. Being able to use data from the previous record for calculations in a query would mean less typing and data space. Hope I have explained things sufficiently.

In access it was something like SELECT ID, AccomName, Address, depart date etc FROM tblTrips WHERE (TripID = forms!frmTrips.TripID -1) ORDER BY TripID

How can I achieve this.

Cheers,

Mike

Edit 29/12/2018 NSW AU time 08:12 PM

Blockquote

First, there was no formed named frmTripandSubForm. Second, you really need to learn more about Base, database and especially SQL. SQL (and not the graphical interface) will provide more answers to problems than anything else. Without it you'll forever be asking questions. Finally, the attached sample is nothing more than the application of all that has been mentioned in the answer already.

frmTripsModified uses the same linked form sub form method had given in the previous sample. It uses individual fields vs the frowned upon table control (told you there is no difference - they are just controls).

frmTripLog_sfmTripsModified uses the SQL approach noted in edit #2 above (and a previous answer).

Blockquote

There have been so many versions and changes to the tables, forms etc. I had to remake the odb from the split database and ended up with some different names. I hope I have finally conformed with the site reply etiquette.

Thanks, will check out the attached file. I have SO MUCH to learn, thank you for your patience.

Mike