Re: Searchform including related tabels.
From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 03/27/05
- Next message: Douglas J. Steele: "Re: How to use the Min and Max Functions in Access 2000?"
- Previous message: Lars Pedersen: "Searchform including related tabels."
- In reply to: Lars Pedersen: "Searchform including related tabels."
- Next in thread: Lars Pedersen: "Re: Searchform including related tabels."
- Reply: Lars Pedersen: "Re: Searchform including related tabels."
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 27 Mar 2005 18:06:04 +0800
If you wish to build a SQL statement that searches for matches based on data
in a related table, a subquery in the WHERE clause might be the simplest
approach.
THe detail will depend on your structure, but typically you end up with
something like this:
SELECT tblShip.* FROM tblShip
WHERE EXISTS
( SELECT tblMaps.MapID FROM tblMaps
WHERE tblMaps.ShipID = tblShip.ShipID );
If subqueries are new, see Microsoft's introduction:
How to Create and Use Subqueries
at:
http://support.microsoft.com/?id=209066
If it is just one related table you need to search, a simple INNER JOIN
would do the trick, but the subqueries are useful where you want to give the
user the freedom to select records from multiple related tables with various
other criteria applied.
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Lars Pedersen" <no> wrote in message news:eHW6p%23qMFHA.3228@TK2MSFTNGP12.phx.gbl... > Hi there. > I have a searchform that builds a query (strSQL) and passes it to a > listbox on the searchform, but how do i include search in related tabels > and also show those data in the listbox. > The mainform is based on tblShip, which has related data in tblMaps. > So far my search only looks in tblShip. > > The searchform is based on the one found on > http://jfconsult.home.comcast.net/tips/ which I can recomend.
- Next message: Douglas J. Steele: "Re: How to use the Min and Max Functions in Access 2000?"
- Previous message: Lars Pedersen: "Searchform including related tabels."
- In reply to: Lars Pedersen: "Searchform including related tabels."
- Next in thread: Lars Pedersen: "Re: Searchform including related tabels."
- Reply: Lars Pedersen: "Re: Searchform including related tabels."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|