Hi all
I have been working on this project now for 4 months and is still no further than the first step. This is driving me to suicide.
As a testing database I have set up the following:
Table 1(Clients) :
ClientID
Firtsname
Lastname
HouseNumber
Streetname
Town
Postcode
HomePhone
MobileNumber
Email
Tabel 2(Treatments) :
TreatmentID
Treatment
Cost
Date
Now I am not sure how to relate these tables . I also want to set up a tabbed form and on the first page only enter new client details but then on the second enter any treatments for existing clients. Now how do you link a specific treatment to a client?
After 4 months I should know how to do this, but I think I have gotten myself into such a muddle I dont know left from right and plus we have just upgraded to Access 2007.
Thanks for any advice.
78 5181 MMcCarthy 14,534
Recognized Expert Moderator MVP
Hi all
I have been working on this project now for 4 months and is still no further than the first step. This is driving me to suicide.
As a testing database I have set up the following:
Table 1(Clients) :
ClientID
Firtsname
Lastname
HouseNumber
Streetname
Town
Postcode
HomePhone
MobileNumber
Email
Tabel 2(Treatments) :
TreatmentID
Treatment
Cost
Date
Now I am not sure how to relate these tables . I also want to set up a tabbed form and on the first page only enter new client details but then on the second enter any treatments for existing clients. Now how do you link a specific treatment to a client?
After 4 months I should know how to do this, but I think I have gotten myself into such a muddle I dont know left from right and plus we have just upgraded to Access 2007.
Thanks for any advice.
Your treatment table needs to have a foreign key to the Client table as follows:
Tabel 2(Treatments) :
TreatmentID
ClientID (Foreign key referencing the Primary key of the clients table)
Treatment
Cost
Date
It would be worth you while checking out this tutorial: Normalisation and Table structures
Hi there
Thank you for reply. Yes sorry, I forgot to mention that I included the Client ID as a foreign key in the Treatments table. I also thought at one point of using a linking table instead, but I suppose that will be wrong. Also the Treatments and Prices will be lookups as they would rarely change.
But I will have a look at that link you included in the reply.
Thanks a lot
MMcCarthy 14,534
Recognized Expert Moderator MVP
Hi there
Thank you for reply. Yes sorry, I forgot to mention that I included the Client ID as a foreign key in the Treatments table. I also thought at one point of using a linking table instead, but I suppose that will be wrong. Also the Treatments and Prices will be lookups as they would rarely change.
But I will have a look at that link you included in the reply.
Thanks a lot
If you have the ClientID in. Set the indexed property to Yes (Duplicates OK). Then open the relationships window and double click on the relations and tick all the referential integrity and cascading options.
On the tabbed form. Set the record source of the main form to clients table and put field controls on first page tab. On second page tab put subform based on treatments table and use master/child properties to link the ClientID fields.
Mary
nico5038 3,080
Recognized Expert Specialist
I get the impression that your clients can have multiple treatments.
In such a case you create a relationtable holding both the ClientID and the TreatmentID.
Additionally you can aad the TreatmentDate and when prices can change, the actual price can be added too. The other option would be to give the treatments also a startdate and when a new price is added, add a row with a new ID, or extract the price with the TreatmentDate from the treatment table when it holds a start (and/or end) date.
Nic;o)
MMcCarthy 14,534
Recognized Expert Moderator MVP
I get the impression that your clients can have multiple treatments.
In such a case you create a relationtable holding both the ClientID and the TreatmentID.
Additionally you can aad the TreatmentDate and when prices can change, the actual price can be added too. The other option would be to give the treatments also a startdate and when a new price is added, add a row with a new ID, or extract the price with the TreatmentDate from the treatment table when it holds a start (and/or end) date.
Nic;o)
Good catch Nico. I'm slipping .. old age you know.
This would mean you would now have three tables one to hold clients, one to hold treatments and one to hold the join relationship as Nico outlined.
Table3
ClientID
TreatmentID
You would then include the join table with the treatments table in a query for the subform.
Bril!
Thank you sooo much guys. I will have a go at your suggestions this morning and see how I get on. I will let you know if I have any more problems.
Thanks a lot
NeoPa 32,564
Recognized Expert Moderator MVP
Hi there
Thank you for reply. Yes sorry, I forgot to mention that I included the Client ID as a foreign key in the Treatments table. I also thought at one point of using a linking table instead, but I suppose that will be wrong. Also the Treatments and Prices will be lookups as they would rarely change.
But I will have a look at that link you included in the reply.
Thanks a lot
Well spotted Nico.
I can see from the OP's second post that he was thinking along the right lines before, but sometimes, when so many issues that you're not sure of all run together it can be so confusing you can't even recognise when you've found the right answer. I sympathise.
That is where TSDN works so well, as we don't have the pressure of all the problems to worry about. A little experience helps too of course ;)
Hi guys, me again!
Sorry to bother you guys again, but I am slightly stuck on another issue. I have now set up the tables as follows : Clients
ClientID
ClientFirstName
ClientLastName
HomeNumber
StreetName
Town
County
Psotcode
HomeTel
MobileTel
Email Treatments
TreatmentID
Treatnment(This uses a lookup column of treatments I have entered)
Cost(This is a lookup column of costs I have entered myself)
Date Client Treatments (This is the linking table for Clients and Treatments)
ClientID
TreatmentID
Now I have managed to set up a form to enter new Clients and this tested fine with all filed in the Client table being populated.
The problem I have is to create a form for new treatments . I want the following fields on the form : Username(This to be concatenated to include First and Lastname), Treatment,Cost, Date. I have tried various different Queries to accomplish this but just cannot find a way to relate a treatment to a client so that the relevant tables are populated with relevant data.I have also added the following to the query to display the username : Full Name:[ClientFirst]&" "&[ClientLast], but still no joy. Just cannot see where I am going wrong.
MMcCarthy 14,534
Recognized Expert Moderator MVP
Create a query as follows: -
SELECT [Client Treatments].ClientID, [Treatment].Treatment, [Treatment].Cost, [Treatment].[Date]
-
FROM [Client Treatments] INNER JOIN [Treatment]
-
ON [Client Treatments].[TreatmentID] = [Treatment].[TreatmentID];
Set up a subform on the Main form based on this query. Use the subform wizard .
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jeremy Weiss |
last post by:
I'm trying to build a database that will handle the monthly billing needs of
a small company. I'm charting everything out and here's what I see:
table for customers
sub table to track payments received.
No biggie, right? Well, here's my problem. I don't know how to tell access
to modify everyone's account balance each month. And I can't...
|
by: Dan |
last post by:
Hi, just ran into my first instance of a backend Access97 database not
compacting. I'm getting the "MSACCESS.EXE has generated errors.." message on
compact.
I've narrowed it down to the largest table which cotains 600k of records.
I've tried copying the database and trying to compact that -doesn't work.
I've tried Repair and then compact...
|
by: Ed |
last post by:
I am running Access 2002 and just ran the built in Access wizard for
splitting a database into a back end (with tables) and front end (with
queries, forms, modules, etc.).
After running the wizard, I opened the table relationship view and noticed
that all the relationships are missing. Is this supposed to happen? If so,
why? I've noticed...
|
by: Neil Ginsberg |
last post by:
I have ODBC linked tables to a SQL 7 database in an A2K database. The linked
tables do not have the password stored in them, so the first time the user
accesses them, they need to enter the SQL password.
I am developing a process that will automatically run at night which will
access those tables. I need to be able to give Access the...
|
by: Gandalf |
last post by:
I'm creating relationships between tables using VBA and ADOX. I can
create one-to-one relationships with an inner join, but I can't figure
out how to create these relationships with an outer join (specifically
a left outer join). I'm including the code that creates the
relationships with the inner join. Any help or suggestions would be...
| |
by: Hi5 |
last post by:
Hi,
I am working on a project in access 2000, Whilst I already have a table
called client and seems to be related with other tables ,I tried making
TBL client as lookup too, I ended up having another table called
Client_1,The question is:
1- How it created?
2- this Why is this table in relationships view and not anywhere else?
3- Is it...
|
by: Bri |
last post by:
Hi,
First let me explain the process I have going on, then I'll address the
problems I'm having:
1) Insert records in a temp table using a query
2) Using a query that joins the temp table with TableA Insert records
into TableB
3) Delete records from temp Table
4) Table specs;
temp Table - 4 fields, 3 indexes, gets 100-4500 records...
|
by: phil-news-nospam |
last post by:
Is there really any advantage to using DIV elements with float style
properies, vs. the old method of TABLE and TR and TD?
I'm finding that by using DIV, it still involves the same number of
elements in the HTML to get everything just right. When you consider
the class attribute on the DIV elements, there's not much size savings
anymore...
|
by: mark_aok |
last post by:
Hi all,
I have a situation where I have a split database. At the back end, I
need to
- create a new table (I will call it newTable) with the exact fields,
and relationships as another table (let's call it oldTable, and I need
to copy everything EXCEPT the data).
- Then I need to delete oldTable, and rename newTable 'oldTable'
|
by: anjee |
last post by:
Hello,
Is it possible to create multiple foreign keys on a field in a table
from values in two separate tables where the field value can be from
one table OR the other?
For example, I have an Invoice table where the Customer field is
linked (foreign key) to the Customer table. As the application has
changed, I now want to introduce the...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |