473,416 Members | 1,778 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,416 software developers and data experts.

Records populating records?

Hi everyone,

This is what I'm trying to do. I making a database for diabetes insulin dosing. I need the current blood glocose (currentbg) to populate the next record in the previous blood glucose (previousbg) field. These will be specialized for individuals in the records. Any ideas on how to do this?

Thanks!
Aug 22 '07 #1
9 1602
Jim Doherty
897 Expert 512MB
Linda,

The explanation is with respect not specific enough you will have to outline how and where your data is being stored. Do you have a single table or more than one table. From the sounds of it you have more than one table??

Jim
Aug 22 '07 #2
missinglinq
3,532 Expert 2GB
Jim is right, we need more information about exactly what it is you're trying to accomplish and how you are entering records. For example, is your data being entered thru a form (it should be) or directly in the table? Is someone sitting down and entering a series of records for a single patient, i.e Patient A's 8am bgl, 12nn bgl, 4pm bgl etc. or is the user entering records for Patient A's 8am bgl, Patient B's 8am bgl, Patient C's 8am bgl? Things like that.

Welcome to TheScripts to both of you!

Linq ;0)>
Aug 22 '07 #3
Here is a general overview of the project. I am trying to create an insulin dosing tool based on change of blood sugar readings over time. I have two tables, one containing patient information (name, physician name, medical record number, etc.) and one containing the information I will need to calculate a recommended dosage (current blood sugar reading, time of current blood sugar reading, previous blood sugar reading, time of previous blood sugar reading, recommended dosage, etc.). I have created a relationship between these two tables based on medical record number. I have created a form (primary is patient data, subform is blood sugar information).

What I would like to do is use the current blood glucose reading and time from one record of the same patient to populate the previous blood glucose reading and time in the next record of the same patient. I would like this to self-populate in the form the next time the patient's medical record number is entered into the form. Is this possible?

I guess it would have to involve sorting the records by patient and date/time of the "current blood glucose reading" then extracting the current information and copying it to the previous information of the new record. Am I making any sense? Can Access do this?

Thanks.
Aug 23 '07 #4
Jim Doherty
897 Expert 512MB
Here is a general overview of the project. I am trying to create an insulin dosing tool based on change of blood sugar readings over time. I have two tables, one containing patient information (name, physician name, medical record number, etc.) and one containing the information I will need to calculate a recommended dosage (current blood sugar reading, time of current blood sugar reading, previous blood sugar reading, time of previous blood sugar reading, recommended dosage, etc.). I have created a relationship between these two tables based on medical record number. I have created a form (primary is patient data, subform is blood sugar information).

What I would like to do is use the current blood glucose reading and time from one record of the same patient to populate the previous blood glucose reading and time in the next record of the same patient. I would like this to self-populate in the form the next time the patient's medical record number is entered into the form. Is this possible?

I guess it would have to involve sorting the records by patient and date/time of the "current blood glucose reading" then extracting the current information and copying it to the previous information of the new record. Am I making any sense? Can Access do this?

Thanks.
Hi Linda,

Forgive me but from what you are saying It seems to me that you MAY have a design issue on the layout of your secondary table?

The Patient table should be fine, in that at least you can correctly identify an individual patient by referencing them using the Medical reference number

The second table is what concerns me! The essence of what you are doing is to record each transaction as it is happens in this table linking this to the medical record number (foreign key linked to primary key one to many). The controlling feature in the 'transaction' is would be a DATE and a time.(No problem thus far)

So.... if we entered a record today we would clearly have the current blood sugar reading to hand and that reading information would be stored in a single row WITH the DATE and TIME.

IF... shall we say three days later we entered another blood sugar level AGAIN that record would be inserted as before. IT IS AT THIS POINT that we can then do the comparison by retrieving from the database the MAXIMUM date and TIME for the individual patient WHERE a record exists PRIOR to the current transaction record that you are currently viewing on screen. This is done by the MAX function in Access.

The only concern I have conceptually in the design (I obviously havent seen it) is that you seem to me to be recording redundant data in the same row. Why type into the SAME row CURRENT AND PREVIOUS information when this can actually be extracted by a sub query and displayed as a column alongside any existing data row without human intervention. A calculation can then be done on the extracted historical data 'as displayed' in the current row set AGAINST the current reading (remember this is 'extracted' and displayed NOT typed manually into that CURRENT row). You then merely enter into that current row the dosage based on any algorithim you have that. Arguably if your algorithim is fixed then this too, could be calculated to give you your dosage without you continually having to work it out manually.

I hope I am making sense to you on this. If not feel free to PM me You guys do a great job!.

In short, Access can manipulate data and arrange and display it in a manner to suit your purposes provided you have a clear understanding of relational theory SQL and DB design. There are plenty of databases out there that started off designed one way became entrenched and which turned out that they wish they dealt with another way

Regards

Jim
Aug 23 '07 #5
Jim Doherty
897 Expert 512MB
Jim is right, we need more information about exactly what it is you're trying to accomplish and how you are entering records. For example, is your data being entered thru a form (it should be) or directly in the table? Is someone sitting down and entering a series of records for a single patient, i.e Patient A's 8am bgl, 12nn bgl, 4pm bgl etc. or is the user entering records for Patient A's 8am bgl, Patient B's 8am bgl, Patient C's 8am bgl? Things like that.

Welcome to TheScripts to both of you!

Linq ;0)>
Thanks for that moderator
Aug 23 '07 #6
Great questions and input Jim,

The reason (I think) I need the previous and current BG info on the same line is because I need both to calculate the dosage. The dosage calculation is based on the hourly rate of change of the BG. It is also helpful for the previous info to appear on the same form so that physicians and nurses can verify the BG changes and thus verify the dosing. A patient's BG would be checked hourly until stable, then every two hours, then every four until stable. Insulin regulated BG is used on all critical or surgical patients with BG above 110 because it reduces the risk of infection. I've already written the logic (code) for the dosing in Excel, but the docs want to be able to query it for a patient's complete insulin dosing record upon discharge, so I thought it would be a good idea to put it into Access. I am having difficulty with the transition though. I am still confused on how to take data from one record and transfer it to another.

Thanks for your help!
Aug 23 '07 #7
Jim Doherty
897 Expert 512MB
Great questions and input Jim,

The reason (I think) I need the previous and current BG info on the same line is because I need both to calculate the dosage. The dosage calculation is based on the hourly rate of change of the BG. It is also helpful for the previous info to appear on the same form so that physicians and nurses can verify the BG changes and thus verify the dosing. A patient's BG would be checked hourly until stable, then every two hours, then every four until stable. Insulin regulated BG is used on all critical or surgical patients with BG above 110 because it reduces the risk of infection. I've already written the logic (code) for the dosing in Excel, but the docs want to be able to query it for a patient's complete insulin dosing record upon discharge, so I thought it would be a good idea to put it into Access. I am having difficulty with the transition though. I am still confused on how to take data from one record and transfer it to another.

Thanks for your help!
Hi Linda,

thanks for the kind words,

I'm not saying you can't have it on the same line I am saying its HOW you get it there that matters. I would do exactly the same thing myself (have it on the same row) BUT make Access display it by calling in the previous entry via a subqueried column rather than typing a previous entry in manually to another field in the same row, thats the issue, you are repeating data as opposed to fetchng up data already entered if you get me. :))

Regards

Jim
Aug 23 '07 #8
Hi Jim,

I think I am beginning to understand. Do you think the best way to do this is to write code for it or to use Access tools to make a query and populate the field with the query results?

Linda
Aug 24 '07 #9
Jim Doherty
897 Expert 512MB
Hi Jim,

I think I am beginning to understand. Do you think the best way to do this is to write code for it or to use Access tools to make a query and populate the field with the query results?

Linda
There are a couple or three ways to do this you could use the DMAX function to return the Last reading date PRIOR to the current reading date for the specific record row (and thus return the reading on that occasion) or you could write a function which could open a recordset in code and limit its return value to the row that you wish to return the previous result from, or indeed you could use the DLOOKUP function to lookup the value of the last entry prior to the current one.

Long term and particularly if your database is likely to grow substantially in terms of datasize, or if you see it as something that might be likely to be a system you seek scaleability on i.e.upsizing to MS SQL server in the future then my advice would be to use raw SQL wherever possible, as it is faster than DMAX or DLOOKUP. These functions are essentially MS Access based whereas SQL is generic and thus more scaleable.

Either way, you place the end results so to speak in the 'Query Grid' as a column to the right of the current reading and then to the right of that any calculation you might wish to make to compare and give the dosage based on comparison between the two results etc etc.

After this you would then would be in a position to display that 'previous' result on the screen form in the same row and because it a computed return value you would lock it off colour it grey or something because it (the return value) would not be editable for that line if I am making myself clear.

Don't get me tooooo wrong on this I am not saying don't use DMAX or DLOOKUP and neither do I wish to be overly technical where you ultimately judge for yourself its just that provided you have options explained to you then you can make an informed choice.

If you get stuck on this.... then if you detail your tables to me ie name fieldname,datatype,size and so on, I could knock up what I am eluding to in minutes and pass it back to you to ponder on, whereas you might struggle trying to interpet what I am typing here. I think you would then see the "aaahhhhh I get it factor" coming into it. Feel free to PM me if you wish or to add to buddy list


Jim
Aug 25 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
3
by: Sidney Linkers | last post by:
Hi, I'm trying to make a calculated text field in a query where the textvalue is being populated from multiple records. I already use a VBA function to loop through records and concatenate the...
1
by: Steve Lilley | last post by:
Hello All Can you please help me with a problem, I'm only looking for a starting point as I am a long way from even knowing exactly what I want to do. Here's the basics anyway, any help much...
0
by: zpq | last post by:
My data consist of records that have a charge start date and a charge end date. The data will all consist of a tenant name and id. for each tenant id, there can be multiple charges identified by...
0
by: Lauren Quantrell | last post by:
I'm using SQL Server backend on an Access 2K front end. I populate a subform: Forms!myForm.myChild.Form.RecordSource = "myStoredProcedureName" On that form is a control where the controlsource is...
8
by: Patrick McGuire | last post by:
I have a treeview control on a windows form that I want to populate in the form's load event. The problem is that the datatable I am using to populate it contains >20,000 records, and it takes > 1...
1
by: Kev | last post by:
Hello I have a form (RosterForm) based on a table - RosterRange RosterRange has 4 fields: RosterRangeID Autonumber RosterStartDate Date RosterEndDate Date (probably...
6
by: sindhu | last post by:
Hello friends, i'm populating a DataGrid with the selected records from DataSet.I'm using a Button to display the contents in dataGrid. but whenever i'm clicking the button the grid is populated...
7
by: wozza | last post by:
hi I'm a Dreamweaver user who's created a few simple data entry/ registrations forms in my time, but I'm not really a coder (though I can follow instructions and am not afraid to dabble...) - I...
2
by: cmrhema | last post by:
Hi, I was asked a question. "You have 10,000 records or rows of data. You are going to bind in a gridview control. Further you have populated the dataset. During page indexing, I want to retrieve...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...
0
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...

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.