Adding New Records To Table Based On Values In Another Table?

Aug 19, 2015

I'm developing a database for the hospital I work in. One purpose of this is to keep track of patients with temporary invasive devices (there are many types such as urinary catheters, ventilators, etc.), specifically how many days each patient has a device for. Each device is associated with one patient only, but one patient may have many devices. Here's how the associated tables are set up:

1. tblPatients - PatientID (PK), LastName, FirstName, DOB,...
2. tblLocations - LocationID (PK), LocationLabel,....
3. tblDevices - DeviceID (PK), DeviceType, Device, DeviceDesc
4. tblDeviceUse - DeviceUseID (PK), DeviceID (FK), PatientID (FK), LocationID (FK) (where in the hospital was device inserted, e.g., operating room, bedside, etc.), DeviceStartDate, DeviceEndDate
5. tblDeviceDailyLog - DeviceLogID (PK), DeviceUseID (FK), DeviceDate, PatientLocID (FK) (area in the hospital that patient is in)

All primary keys except for PatientID & LocationID are Autonumbers; and the tables are linked appropriately.

Whenever an entry is made into tblDeviceUse, I want there to be new records to be automatically generated in tblDeviceDailyLog for each date between the Start and End Dates. For example, patient A123 had a urinary catheter from 1/1/2000 to 1/10/2000 that was inserted while the patient was in the ICU, but the patient was moved to the Medical Ward on 1/7/2000. So tblDeviceDailyLog should have 10 new records associated with this device, one for each calendar day, with the appropriate location for each day.

View Replies


ADVERTISEMENT

Adding Value In Table Based On Values In Two Other Fields

Dec 3, 2007

Hello: Is there (simple) way that I can populate a field based on the values of two other fields? For example, in a list of new employees, if a new employee starts on Nov 30 and works in the Administration Department, his human resources contact is Mary. If a new employee starts on Nov 30 and works in Sales, his contact would be Fred. I hope this is clear! Many thanks!

View 12 Replies View Related

Using Boolean 'and' To Update A Table Based On Values In A Link Table

Feb 24, 2008

The attached Access XP file demonstrates my problem. I've included a form to make testing easier.

Each record in the Projects table has one or more linked entries in the Keywordlink table, showing keywords that apply to that record. Each record in Projects has a Yes/No 'Utility' field.

A third table, Keywords, supplies the keywords that the user can apply to records in Projects, using the subform on the main form. The Keywords table also includes a True/False 'Utility' field. I have set this to True for for the first three keywords.

I need a query, a series of queries or some VB code that updates Projects_Utility for all records to True if and only if the record's linked entries in Keywordlink include all of the keywords for which Keywords_Utility is True (a boolean 'and', as opposed to an 'or'). Otherwise, Projects_Utility must be set to False.

In the attached file, with the current settings in the Keyword table, the 'GetSelectedProjects' query should then produce single-row listings for ClientA and ClientF.

I'd appreciate any help you can give me on this. I'm not a programmer, but I can manage a bit of VB code if I have to.

View 5 Replies View Related

Modules & VBA :: Replace Values In One Table Based On 2nd Table

Jan 12, 2015

I have a table (tblConversions) that I'm using as a base for replacing values in a different table. tblConversions is set up as such and is made up of nearly 100 records:

ID LABEL CODE
1 Ashaway ASH
2 Barrington BAR
3 Bristol BRI
4 Jesse Smith BUR
....

Another table (tblSysItemLoc) has nearly 1,000 records with a field for Location Names such as Ashaway New Books, Ashaway Fiction, Ashaway Non-Fiction, Barrington DVDs, Barrington Reference, etc. Other fields in this table are just statistics.

What I need to do is loop through tblConversions, and find in tblSysItemLoc where the Location field Starts With the value from tblConversion.LABEL and replace the Entire field with the CODE. For example, from tblSysItemLoc "Ashaway New Books" gets changed to "ASH", "Barrington Reference" gets changed to "BAR", etc.

I feel like I need a loop inside of a loop, but I'm not sure where to begin. Loops are not my specialty.

View 10 Replies View Related

Queries :: Calculation Based On Values Selected In Table By Looking Up Corresponding Values In Other Tables

Aug 29, 2014

I'm using Access 2010. I need to calculate a score based on values selected in a table by looking up corresponding values in other tables. I have a "Project" form to create new entries into the Project table (see Table 1). When I create a new project record, I will select values for the Payback and Need fields by selecting options from a list. The Payback list is pointed at Table 2 and the Need list is pointed at Table 3. In the below example, I created the "ABC" project and selected "1 year" for the Payback field and "Repair" for the Need field. Pretty simple.

Now that I have the "ABC" project loaded to my Project table, I'd like to create a report that will show a "score" for this project. The score should be calculated as follows: Payback Impact + Need Impact. In this example, the score should be 30 (Payback Impact of 20 + Need Impact of 10).

View 5 Replies View Related

Insert Records Into Table Based On The Select Criteria From The First Table.

Mar 22, 2005

Hi

I have a small database with 4 tables that I am using for the current problem.
The tables are call, parents, mailman, orders.
Call and parents are related by the call ID (a primary key in the Call table.).
Mailman and orders are related by a Unique Id (a primary key in the mailman table.).

Forms involved are frmmain and frmsub.

Frmmain contains the call table information in the main form and parents information in the subform.

When a user enters a call with call ID and enters the operator name and parents information in the sub form,
When a user clicks the OK button on the main form, necessary changes should take place
if they enter the case type in the sub form part of parent information as ‘missing information’ or ‘missing link’ then the parent information with fields first name, lastname, case type, operator information should be inserted into mailman table in appropriate fields.

Simultaneously a record should be inserted into orders( after the record is first inserted into mailman, since both tables are linked with unique id) with the following information.
Orderid being autonumber.
Uniqueid from the mailman table.
Orderdate system date.
Ordertype should be “Mailman”

View 4 Replies View Related

Adding Up Two Values And Displaying It In The Same Table

Jun 20, 2007

Hi,

Im trying to create a database for a stock control system. I have a slight problem, the stock is in two places. So what i have to do is put in the values of stock in each place and then display the value of those two added up in the table. What is the best way to be able to do this?

View 12 Replies View Related

Adding Values In A Form Then Putting It In A Table HELP

Sep 1, 2005

Hey there, Im currently making a form so users can enter project information. For this particular project, the user must choose from a variety of options, and each option has a number value assigned to it for a rating. Now at the end of this form, I want a sum of the ratings, and then entered into the table. I am using a text box for the sum of ratings, and can get the sum of ratings to work on the form, but this data is entered as a 0 in the table. If anyone could help me find a way to put the actual sum in the table, that would be excellent.. thx a lot.

If it would be any help, here are the names of text boxes that I'm adding:

Health and Safety Rating, Maintenance Rating, Equipment Rating, School Size Rating, Student Enrollment Rating, SD Priority Rating, Project Requested Previously Rating

Those ratings must be added into "Total Rating"

Thankyou!

View 1 Replies View Related

Adding Feild Values And Storing In Another Field In Same Table

Mar 19, 2005

I have been struggling with this and would appreciate any help. It sounds so simple!!! I have 4 fields (Unit Price 1, Unit Price 2, Unit Price 3, Unit Price 4) in a Orders table that I want to add together and store in a 5th field (Sub Total) in the same table using a form. I am having problems with the sum and I am unsure how to get it to show in the Sub Total box in the form as well as the table. Thanks for your help!!

View 2 Replies View Related

Queries :: Adding New Column In A Table And Populating Values

Mar 2, 2014

I have a table having fields start date and end date. I need to calculate difference in the dates and store the values in a new column in the same table. I am able to write the query for this but am clueless as to how to put in these values in a new column in the table.

View 2 Replies View Related

Insert X Records In Table Based On Value From Another Table

Jan 9, 2007

Newbie question: I have a database where we track dispatched with two tables, one called Slots, the other called Dispatches.
In the slots table there are 2 fields, one called Week (which hold the Monday date for each week in the year), the other called Available (in this field we want to manually enter a number that will tell the system how many dispatches we can do that week). We want to automatically take the number from the Slots.Available and enter X number of blank records in the Dispatch table with the monday date.
How can this be done?
Then we will create a form that can be filled in with the balance of the information.
Thanks

View 3 Replies View Related

General :: Adding A Path For Photo Based On Table Info

Nov 18, 2014

I have a form where I can add a new resident. It runs off a query that shows ID as null and has a button to add the data and refresh the form and query. I used to drop in OLE files but have since changed it to a linked image file. What I want to do is pull the info from the data that I input as a new resident.

Basically it means that any staff member can take a photo of the resident and put it in a folder and the database will point to that file.

The location is..."C:UsersRP"&[First Name]&" "&[Last Name]&".jpeg" First Name and Last Name are in the table already. I have tried using an append and an update query to no avail.

View 2 Replies View Related

Adding Records To Table

Feb 9, 2005

Hope someone can help!
I was wondering if is possible to add a series of records that are in serquence to a table by just entering the first and last numbers. For example a string of numbers starting at TP11000 and ending at TP11100, the prefix TP doesn't change. Currently I have to enter every one manually, so any help would be much appreciated!

View 4 Replies View Related

Adding Records To A Table From A Form

Apr 11, 2006

I am new to Access and have the following problem. I have one table which displays Skills (memo field) a second table which displays a skill rating ( 5 choices) and a third table which list the jobs in the company. I need to compile a fourth table which lists the skills required for each job and the corresponding ratings. I would like to have a Form in which I select the job and all 560 skills are displayed in datasheet format and I can select the ones required and allocate a skill rating. The results should then be saved to the new Table.

Any ideas as to how to acheive this task.

View 2 Replies View Related

Adding Records Directly To A Table.

Aug 13, 2007

Here is basically what I have and what I need to do:

I have a form with several text boxes which are going to be filled in. Clicking on a button at the bottom of the form will save this information into a table (the table associated with the form). However, it also needs to fill in a junction table with two known values derived from these text boxes.

I have FILE_NUMBER_CD and INSPECTOR_NUMBER_CD that are the only attributes in the table called "XREF_FILE_INSPECTOR" which need to be added as new records.

So basically, what I need to know is how do I add known values derived from a textbox directly into a table.

Thanks for any help!

View 1 Replies View Related

Adding New Records To A Linked Table

Jun 5, 2006

Greetings all.

I'm posting this question here as it pertains to my form but it could go in tables section as well.

I developed a prototype app in Access and have just finished upscaling it
to Sybase 12.5. When I open up the associated form to add records, I am unable to do so. The built in button that allows you to do so is greyed out.
When I go into the table directly, again, no ability to add recs.

I've never come across this so if anyone has any experience with this, any help would be most welcome.

TIA,
Tim

View 1 Replies View Related

Adding Records To Related Table

Sep 28, 2006

Hello I need to add daily records to a related table using a form, from a button or subform displayed on a form updating the master table.
This would enter the related key to the new form ready for insertion etc.
Can this be done?

For example

Master table:
Key 1


Related table:
1 Key 1
2 Key 1
3 Key 1


jamo

View 2 Replies View Related

Adding Records To Table From Other Form

Oct 12, 2006

I have a form "release_details" having fields date, version, cksum ,comments,labels, and is link to a table,
it has a button "mai"l ,on clicking this button a new form is open which has a button "send mail" on clicking this a mail is sent and pops a message "mail sent".I need when "send mail" is click it should also save the fields of form
"release_details" to the table.


cmdSend_Click()
Forms!Enter_Release_details.Dirty = False

View 3 Replies View Related

Grabbing Values From A Table Based On Form Entry

Jan 5, 2006

In my database I have 4 tables for a small painting and decorating business.

These are:
tblCustomers, tblOrders, tblStock, tblPayments.

I have a form based on tblOrders to add new orders when they come in from customers.

In this form there are 3 important fields: "CustomerID" (Lookup to tblCustomers), "StockID" (Lookup to tblStock) and Quantity (Entered by user).

However, I want a calculated field that will be worked out automatically when the user is entering these details. The calculated field should go to tblStock and grab the "Cost" field.

However the main problem is specifying what price it will grab from the table. I want it to get the "Cost" where "StockID" = (the stock ID selected in the lookup). I then want to multiply the price by the quantity which the user has entered.

The control source should be worded something like:
= ([tblStock]![Cost] where [StockID] = StockID)*Quantity

but that isn't valid.

Could anyone point me to a piece of VBA or some way to get around my problem?
Many thanks for any help,
Stephen

View 2 Replies View Related

Queries :: Sum Table Values Based On Combo Box Selection?

May 20, 2014

I am trying to write a query that gets all the telephone hours from a worker done under supervision in a town (qry_svhoursbytown). I have a table that has the workers details, including town (Crisis_support_workers), then another table that has what hours each worker has done (Supervision_Hours). The town is selected from a combo box on the form (frmSearch), under the heading �total hours by location�.

I try and select Bathurst then press recalculate results and in the text box next to supervision hours, it says 66, but if you look in the Supervision_Hours table, there is only 11 hours for the workers that are in Bathurst.

In the query, I have the sum total of the hours field in the Supervision_Hours table, the Town field from the Crisis_support_workers table with the total selected as Where and in that criteria I have [forms]![frmSearch]![ComboTown], then I just have the town field displayed.

What do I need to change to get it to sum correctly?

I have attached the database below so people can take a look.

View 1 Replies View Related

Forms :: Open Form Based On Table Values?

Sep 8, 2014

I have a table with the fields Thermometer_ID (primary key) and CalibrationType (combo box list with the options of InHouse or SendOut)

I want the user to click on a button and have an input box to input the thermometer_id. Then if the CalibrationType is InHouse open form Verification and if it's SendOut open form Thermometers.

View 2 Replies View Related

Forms :: How To Get Values From Another Table Based On Drop Down List

Aug 6, 2014

In my form's table (tblMain), I've got a lookup field (drop-down list) that lists the primary key field from a different table (tblDiff). tblDiff includes 3 more fields. In my form for tblMain, I want to include 3 more textboxes that get filled up with these 3 fields from tblDiff when the corresponding primary key is selected in the drop-down box.

View 9 Replies View Related

Adding New Record With Table That Has Duplicate Records

Jan 26, 2005

My situation:

I have a table with duplicate ids. When I have a forum popup another form, the forms are linked by ids. This works great except for one problem. There are duplicate ids. So if I pop up a form then it will go to the first record that that id exist. This is not good if you are going to add another record. Therefore, I need to create a unique variable for a record. The autonumber would be a great variable but it seems I cannot use it to filter. Unless someone can show me how. Is there another way to create a unique variable automatically for a new record?

View 5 Replies View Related

Modules & VBA :: Adding All Records From A Subform To Table?

May 26, 2015

I am working with a database that deals with trailers. What is happening is a salesman takes an order for a make and model for a trailer for a customer. The customer can then add some customization to the trailer such as more tail lights or tie down straps. They add the customization on a form called frmCustomQuote. On frmCustomQuote there is a subform called sfQuoteConfigs. On sfQuoteConfigs there is fields such as category and sub catergory that get populated bases on what was selected.

On frmCustomQuote there is a button called "Copy Quote" this will allow the salesman to make an exact copy of the trailer and customization. The quotes are held in a table called tblQuotes and the customization is held in tbQuoteConfigs. Now my problem is when I click on Copy Quote it only copies the first record into tbQuoteConfigs. I can't figure out a way to tell my code to move to the next record within sfQuoteConfigs.

My code:

Code:
Option Compare Database
Option Explicit
'Setup ADODB connection to the tblQuotes
Dim adoQuotesCustomQuote As New ADODB.Recordset
'setup ADODB connection to the tbQuoteConfigs
Dim adoQuoteConfigsCustom As New ADODB.Recordset
'Dim the Variables

[code]....

View 4 Replies View Related

Tables :: Adding Records To Existing Table

May 19, 2014

What I have is a database that I have done some tweaking on and in the meantime the original db has been in use which has added around 200 or so more records in the table.

What I would like to do is to just update the db that I have been working on with the older db table(the one who has the additional 200 records).

EX. DB A(Old DB, Newer Table) DB B(New DB, Older Table)

I want to put DB A table into DB B

Is this a simple fix? Or do I need to write some sort of query to update the records in the old table? I've tried to export the excel file and then import but it puts it in unrelated objects and then my switchboard or nothing works.

View 9 Replies View Related

Modules & VBA :: Adding Records In Multiple Table

Nov 13, 2013

I have two tables :

Table 1: Mission_Id , Mission_Type, Customer_Name...
Table 2: Supporter_Name, Report_Date, Area, Unit, Issue_Type, Error_Status,Mission_Id

I have a form that the users enter data into and send a report each day. I would like that in a click of a button all the data I entered the day before and that have ="Open" will be entered into the tables with today's date. Is that possible?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved