473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

elegant solution to many-to-many table/form problem

hi,

once again apologies if I'm covering old ground. I've looked through
lots of previous posts and tried some code but nothing works as yet.
However, the problem must be a very common one so I'm slightly
surprised there isn't more on this (unless I'm missing something -- if
so please just point me in the right direction), and the textbooks are
also strangely silent.

I need to do the following:
* be able to associate any combination of a set of problems with a
list of patients (hence many-to-many relationship with junction table)
-- the list of problems is added to regularly so using checkboxes is
out of the question
* the solution that appeals to me is the ability to transfer possible
problems between listboxes with >, <, >> & << buttons and then write
the selected problems to the junction table.

So far I've got three tables: Patients, Problems and PatientProblems,
but I need a lot of help implementing the second part of the solution.
Also, if anyone knows of a more elegant way of handling this kind of
situation I'd really like to hear it.

many thanks
Adriaan
Nov 13 '05 #1
3 2187
If what you have for problems lends itself, you need another table,
TblProblemType.

For data entry you need a main form based on TblPatient or a query based on
TblPatient with a way to select the patient record. The subform would be based
on TblPatientProblem. The linkmaster/linkchild properties would be PatientID. In
the subform you would have synchronized comboboxes for first selecting the
problem type and then selecting the problem.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Adriaan van Heerden" <ad*****@postmaster.co.uk> wrote in message
news:89**************************@posting.google.c om...
hi,

once again apologies if I'm covering old ground. I've looked through
lots of previous posts and tried some code but nothing works as yet.
However, the problem must be a very common one so I'm slightly
surprised there isn't more on this (unless I'm missing something -- if
so please just point me in the right direction), and the textbooks are
also strangely silent.

I need to do the following:
* be able to associate any combination of a set of problems with a
list of patients (hence many-to-many relationship with junction table)
-- the list of problems is added to regularly so using checkboxes is
out of the question
* the solution that appeals to me is the ability to transfer possible
problems between listboxes with >, <, >> & << buttons and then write
the selected problems to the junction table.

So far I've got three tables: Patients, Problems and PatientProblems,
but I need a lot of help implementing the second part of the solution.
Also, if anyone knows of a more elegant way of handling this kind of
situation I'd really like to hear it.

many thanks
Adriaan

Nov 13 '05 #2
Adriaan van Heerden wrote:
hi,

once again apologies if I'm covering old ground. I've looked through
lots of previous posts and tried some code but nothing works as yet.
However, the problem must be a very common one so I'm slightly
surprised there isn't more on this (unless I'm missing something -- if
so please just point me in the right direction), and the textbooks are
also strangely silent.

I need to do the following:
* be able to associate any combination of a set of problems with a
list of patients (hence many-to-many relationship with junction table)
-- the list of problems is added to regularly so using checkboxes is
out of the question
* the solution that appeals to me is the ability to transfer possible
problems between listboxes with >, <, >> & << buttons and then write
the selected problems to the junction table.

So far I've got three tables: Patients, Problems and PatientProblems,
but I need a lot of help implementing the second part of the solution.
Also, if anyone knows of a more elegant way of handling this kind of
situation I'd really like to hear it.

many thanks
Adriaan


The Access 2000 Developer's Handbook's (Desktop Edition) Chapter 7
contains an example of exactly what you're looking for. The section is
called "Making Multiple selections in a List Box".

I don't have the A2002 version of the book, but if that's what you're
using and you don't have the book, it's well worth buying.

Nov 13 '05 #3
thanks Bruce. I won't be able to buy the book for a while (limited
finances, say no more) but I found some code in this newsgroup which
seems to derive from the book you mention. I've got the listboxes to
work (if anyone wants to know drop me a line) and I've also got a
"Save Problems" button which executes the following code
("PatientHospNo" is the textbox holding the Patient ID):
************************************************** ***********
Private Sub btnSaveProblems_Click()
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String

Set frm = Forms!frmEpisodes
Set ctl = frm!lstSelected

For Each varItem In ctl.ItemsSelected
strSQL = "INSERT INTO tblPatientProblem(Patient, Problem)
VALUES (" & frm.PatientHospNo.Value & ", " & ctl.ItemData(varItem) &
")"

CurrentDb.Execute strSQL, dbFailOnError
Next varItem

End Sub
************************************************** ***********
Unfortunately this still doesn't work -- the debugger stops at "For
Each varItem In ctl.ItemsSelected" and nothing is written to the
junction table (tblPatientProblem). I'm still trying to figure out why
....
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: python_only | last post by:
Check it out! Readable switch construction without lambdas or dictionaries: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410692
2
by: Brian Wolfe | last post by:
What is the diffierence between a "Blank Solution" and a new "Project"? Thanks.
5
by: jiangyh | last post by:
hi guys: I have a task that need a windows application and a web applicition.That windows application run in the client side and web application run in the server side. My question is can I...
2
by: msnews.microsoft.com | last post by:
Hi, Is there any application or Tool, which will give me the following information: 1. All the functions in my solution. 2. Which function is called from which location. Based on my...
3
by: Alfredo Barrientos | last post by:
Hi, I am trying to debug a internet solution with 4 kind of projects: 1. Presentation Layer: ASP.Net Pages 2. Service Interface Layer: Web Services 3. Business Layer: COM+ Classes 4. Data...
7
by: Larry Woods | last post by:
I don't see the pattern. I have a couple of solutions that I acquired from someone else. When I load these, I see the .vbproj and .vbproj.user files in the Solution Explorer. BUT, when I create...
1
by: Tom C | last post by:
In the visual studio IDE, how do I delete a whole solution using Solution Explorer? I can delete the projects in the solution, but not the solution itself.
2
by: Gernot Frisch | last post by:
I have a struct, that has a lot of double variables. (only doubles, assume). Now, each variable has a different "default" value, which is set in Init function. So, is there any better way of...
0
by: Deep | last post by:
Hi I am using Visual Studio 2005 . and the project also been developed in Visual studio 2005 . when i open sloution file it shws follwing error the selected file is not a valid visual studio...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.