Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 18th, 2007, 12:18 PM
Authorized User
 
Join Date: Jun 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Many records in a one record ?

Hi,

I am dealing with a problem that i need to show more than one records in a one record separated by comma.

I am using Ms Access 2007
i.e

tables

Employees:
------------
empID
empDept

Departments:
--------------
deptID
deptName

empDepts:
-----------
empID
deptID



here one employee working for more than one departments.
i just want to show all related departments separated by comma in main EMPLOYEE table field empDept.

SQL help please.
__________________
Stay Beautiful,
Abdul Salam
 
Old December 18th, 2007, 02:29 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I would keep your current junction structure (many to many), and then add the display element to forms and reports when needed, and not concatenate the department in the main table. I would also do this:

empDepts:
-----------
empDeptsID - PK
empID - FK
deptID - FK

I can show you how to display the departments for an employee using regular expressions and an extra text box. I do this sort of thing now and then on forms and especially in reports.

mmcdonal

Look it up at: http://wrox.books24x7.com
 
Old December 18th, 2007, 02:32 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Actually, if database bloat is not an issue, you can create a memo field that contains this data as well as your current junction structure, and then update that memo field whenever the record is changed (Before Update event.)

Normally there are posts on this site that ask how to undo the sort of solution you are looking for.


mmcdonal

Look it up at: http://wrox.books24x7.com
 
Old December 24th, 2007, 03:42 AM
Authorized User
 
Join Date: Jun 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Aha! I am not interested buying books .. thank you.

I know to write code for this but i need a query not code behind the form or report.

Well.... is there any way to define variable in access query and can i create loop .... if else for etc.. any loop ...

thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
Add a new record between two existing records hsncompany BOOK: Beginning Access 2003 VBA 0 April 13th, 2008 03:36 PM
more than one records in a one record? abdusalam SQL Language 0 December 18th, 2007 12:22 PM
problem in updating records & finding records naveed77 VB Databases Basics 1 January 16th, 2007 12:12 PM
problem in updating records & finding records naveed77 VB How-To 1 January 16th, 2007 12:10 PM
selecting multiple records as one record array Greywacke Classic ASP Databases 1 February 10th, 2004 10:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.