Ask Your Question
0

How to return table ID and Name from a linked table in a query

asked 2019-01-17 23:22:52 +0200

Mycle gravatar image

My DB (below) contains a complex (SQL code wise) query "qryTripSectors" ( thanks to @Ratslinger's assistance ) which is working as I want.

A form "TripSectors" based on the table "TripSectors" which is used to enter information such about each part of a trip. TripLogID and PreviousAccommodationID are selected using Listboxes on the form.

To display trip details for each TripLogID the form "Trips" is used with controls linked to the Table "TripSegments" and Subform controls linked to the query "qryTripSectors" mentioned previously.

This query returns previous values from the table "TripSectors" and also formatted and calculated fields for use in the form "Trips" pic below!

There is no need to use a listbox in the Previous Accommodation details section of the form. I have attempted basing "qryTripSectors" on a new Query using " *.TripSectors " and "Accommodations"."Name" without success. It returns DATA CONTENT COULD NOT BE LOADED Errror (Cannot be in ORDER BY clause in statement).

Am I making this too complex, is there some other way to do this. I would rather use a Textbox on the form "Trips" Depart Details section in place of the Listbox "PrevAccom". How can I display the name of the Accommodation not the ID number using a Textbox. Or is there a way to display the contents of the Listbox similar to a Textbox. Tried turning off the dropdawn and disabling the tab stop but then it looks weird with a slidebar at the bottom. See Pic. C:\fakepath\BaseVanTripsVer7.5.odb image description

Cheers,

Mike

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-01-18 00:24:42 +0200

Ratslinger gravatar image

Hello,

Have actually provided this information before in another sample -> Query previous record for form control in sample: EditedFromMycle.odb in Query1.

Have taken this and applied to the attached sample. Form is TripsModified and SubForm1 uses query qryTripSectors3.

Sample ---- NameVsID.odb

edit flag offensive delete link more

Comments

Thank you, I had been mucking around with the query and lost it obviously.

Mike

Mycle gravatar imageMycle ( 2019-01-18 02:33:37 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-01-17 23:22:52 +0200

Seen: 27 times

Last updated: Jan 18