Results 1 to 7 of 7
  1. #1
    mikichi is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2013
    Posts
    45

    numbering a table

    hi,
    i work in a hospital and in our hospital we need to visit evrey patient and i need to track visits.
    i want to track who visited which patient and when.
    one of my fields in my table is the date of the next visit we have to do.
    the first visit must be in 7 days.
    second visit must be in 14 days from the first visit
    and third visit and forword need to be in 21 days from the previous visit.

    i built a table named Patient have a 1 to many relationship with table named Visits.
    when a patient come to me i add him to Patients table and evrey visit i add to Visits table.


    how to calculate what need the next visit to this patient?
    thank you very much!
    miki

  2. #2
    Gina is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2014
    Posts
    10
    Hello,

    If you are not going to create a form to enter the data you will have to enter the formulas in the field default value properties of the table.

    For example, your fields in the table could be:
    FirstVisit...........Default Value, Date()
    NextVisit..........Default Value, DateAdd ("d", 7, Date())

    You will have more control if you create a form to enter your data since you will not be forced to use the Date() function and can enter the First Visit Date manually if you choose. If you choose to create a form, you would then add the DateAdd function in an unbound text box.

    =DateAdd ("d", 7, [FirstDate])
    =DateAdd ("d", 14, [FirstDate])

    Best,
    Gina

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You can use the form's On Current event to calculate differences in dates and display the results using unbound controls and perhaps format fonts of certain controls. Maybe the Datediff() function with an If Then statement or a Select Case statement will help with calculations

  4. #4
    mikichi is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2013
    Posts
    45
    sorry i think that i dont explain my self very well, probably because my horrible english.
    i have a forms to enter the visits and new patients.
    i have a Patient table that i insert all my patient with next fields: TreatmentID, PatientID Name, ArrivalDate, and i have a Visit table with: TreatmentID, VisitDate.
    Patient table have a 1 to many relationship with visit table so evrey records in Patient i can have a many records in Visits.
    i need to count how much visit i have to every TreatmentID(if i dont have any visit to this treatmentID i need visit him in 7 days and so on)
    i just dont know how to count the vistis for TreatmentID.
    thank you!!
    miki

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Counting records and calculations should probably be managed in two steps. You can create a totals query using the query builder that will count records. You can use a domain function like Dcount() to return a count of records.

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    i have a Patient table that i insert all my patient with next fields: TreatmentID, PatientID Name, ArrivalDate, and i have a Visit table with: TreatmentID, VisitDate.
    This does not look correct. I think your table structure needs a little modification.

    What are the field names in tblPatients and tblVisits?
    What field is the primary key in each table"
    Are the primary keys of type Autonumber?

    "TreatmentID" should not be in "tblPatients". "Firstname" is an attribute of a patient; "TreatmentID" is not an attribute of a patient.
    The primary key in "tblPatients" should be in "tblVisits" as a foreign key field. (one patient can have many visits)

    Can each visit have many treatments? If so, might need another table.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    I agree with Steve. We don't know your detailed database set up nor your business rules.
    I see tables such as

    tblPatient
    PatientID PK
    PatientDetails ...

    tblTreatment

    TreatmentID PK
    TreatmentDetails...

    tblPatientVisits
    VisitID PK
    PatientID FK composite unque index
    VisitDateTime

    VisitCommnents


    tblPatientTreatment

    PatTreatID PK
    PatientID FK
    TreatmentID FK unique composite index
    TreatmentStartDate
    TreatmentEndDate

    Other Info re Patient Treatment

    Just my $.02

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with numbering
    By hudsonp in forum Access
    Replies: 3
    Last Post: 11-21-2012, 08:55 AM
  2. Replies: 2
    Last Post: 07-27-2012, 09:07 AM
  3. Replies: 33
    Last Post: 06-17-2009, 10:22 AM
  4. Numbering records
    By knightjp in forum Database Design
    Replies: 0
    Last Post: 08-17-2008, 07:07 AM
  5. Auto Numbering
    By rkruczk in forum Forms
    Replies: 0
    Last Post: 10-09-2006, 04:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums