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

Historization of Data

48
Hi folks,

I have (maybe) a challanging question. First, how does evertything look like:

I have a DB (of course) with relations like:

Expand|Select|Wrap|Line Numbers
  1. ____________                      _____________ 
  2. | ContactsID   |                     | WorkID         | 
  3. |     Name      |  1 --------> N |   Workstream | ----->  Workstream
  4. |     Phone      |                  |   CostCenter  | ------> CostCenter
  5. |       etc         |                 |    Vendor       |  -------> Vendor
  6.  
  7.  
What I would like to implement is:

That a Contact A can have two WorkID. However, first say yesterday I have added Contact A and today he switches Workstreams. So, I would like to "click" a button, which opens a new Work_subForm, but without removing Contact Information. Basically, one ContactID with several WorkID. I think it should be possible to just make on my navigation bar a button, where "create new work Information". Right? But how? With an update/insert SQL, but then how do I tell the SQL-statement to "flush" the form?

More clarifications: I have a form, where you first type in all Contact information, then you switch pages to Work_sub.

I know what I have to do, but I do not know how. I would highly appreciate if somebody gives me some hints, keywords, so I could do some research and give my best shoot to solve the challange.

Thanks a lot.

Alive
Aug 15 '07 #1
7 2899
FishVal
2,653 Expert 2GB
Hi folks,

I have (maybe) a challanging question. First, how does evertything look like:

I have a DB (of course) with relations like:

Expand|Select|Wrap|Line Numbers
  1. ____________                      _____________ 
  2. | ContactsID   |                     | WorkID         | 
  3. |     Name      |  1 --------> N |   Workstream | ----->  Workstream
  4. |     Phone      |                  |   CostCenter  | ------> CostCenter
  5. |       etc         |                 |    Vendor       |  -------> Vendor
  6.  
  7.  
What I would like to implement is:

That a Contact A can have two WorkID. However, first say yesterday I have added Contact A and today he switches Workstreams. So, I would like to "click" a button, which opens a new Work_subForm, but without removing Contact Information. Basically, one ContactID with several WorkID. I think it should be possible to just make on my navigation bar a button, where "create new work Information". Right? But how? With an update/insert SQL, but then how do I tell the SQL-statement to "flush" the form?

More clarifications: I have a form, where you first type in all Contact information, then you switch pages to Work_sub.

I know what I have to do, but I do not know how. I would highly appreciate if somebody gives me some hints, keywords, so I could do some research and give my best shoot to solve the challange.

Thanks a lot.

Alive
Nice drawing but unfortunately doesn't make sense. For example I can only guess what field in tblWork is ForeignKey to tblContacts, as well as what are field types.

Here is an example of how to post table MetaData :
Table Name=tblStudent
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. StudentID; AutoNumber; PK
  3. Family; String; FK
  4. Name; String
  5. University; String; FK
  6. Mark; Numeric
  7. LastAttendance; Date/Time
Aug 15 '07 #2
alive84
48
Nice drawing but unfortunately doesn't make sense. For example I can only guess what field in tblWork is ForeignKey to tblContacts, as well as what are field types.

Here is an example of how to post table MetaData :
Table Name=tblStudent
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. StudentID; AutoNumber; PK
  3. Family; String; FK
  4. Name; String
  5. University; String; FK
  6. Mark; Numeric
  7. LastAttendance; Date/Time
I see, sorry, I hoped this would make sense :-).

tblContacts
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. ContactID, AutoNumber, PK
  3. FirstName, Text, 
  4. etc.
  5.  
  6.  tblContact 1---> N tblWork 
  7. WorkID, AutoNumber, PK
  8. ContactID, Number, FK
  9. StartDate, Date, 
  10. EndDate, Date,
  11. WorkstreamID, Number, FK
  12. OrgUnit, Text, FK
  13. CostCenter, Text,
  14. Region, Text,
  15. VendorID, Number, FK
  16.  
tblWorkstream, tblCostCenter and tblVendor have a simple relationship with tblWork. In Access the option 3.

Hope this makes more sense.

Thanks,

Alive
Aug 15 '07 #3
FishVal
2,653 Expert 2GB
I see, sorry, I hoped this would make sense :-).

tblContacts
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. ContactID, AutoNumber, PK
  3. FirstName, Text, 
  4. etc.
  5.  
Expand|Select|Wrap|Line Numbers
  1.  tblContact 1---> N tblWork 
  2. WorkID, AutoNumber, PK
  3. ContactID, Number, FK
  4. StartDate, Date, 
  5. EndDate, Date,
  6. WorkstreamID, Number, FK
  7. OrgUnit, Text, FK
  8. CostCenter, Text,
  9. Region, Text,
  10. VendorID, Number, FK
  11.  
tblWorkstream, tblCostCenter and tblVendor have a simple relationship with tblWork. In Access the option 3.

Hope this makes more sense.

Thanks,

Alive
Ok. Thanks. Now it is almost absolutely clear.

Do you mean adding record with the same WorkID and different WorkstreamID.
If so you need to make one more step for db normalization and split tblWork in the manner like this.

tblWork 1-->N tblWorkWorkstreams N<--1 tblWorkstream
(creative! no? :) )
Expand|Select|Wrap|Line Numbers
  1. tblWork
  2. WorkID, AutoNumber, PK
  3. ContactID, Number, FK
  4. StartDate, Date, 
  5. EndDate, Date,
  6. OrgUnit, Text, FK
  7. CostCenter, Text,
  8. Region, Text,
  9. VendorID, Number, FK
  10.  
Expand|Select|Wrap|Line Numbers
  1. tblWorkWorkstreams
  2. WorkWorkstreamID, Autonumber, PK
  3. WorkID, Number, FK
  4. WorkstreamID, Number, FK
  5. SwitchedOn, Date
  6.  
Now you see you've got a table where history of WorkstreamID changing within particular WorkID is stored.
Aug 15 '07 #4
alive84
48
Ok. Thanks. Now it is almost absolutely clear.

Do you mean adding record with the same WorkID and different WorkstreamID.
If so you need to make one more step for db normalization and split tblWork in the manner like this.

tblWork 1-->N tblWorkWorkstreams N<--1 tblWorkstream
(creative! no? :) )
Expand|Select|Wrap|Line Numbers
  1. tblWork
  2. WorkID, AutoNumber, PK
  3. ContactID, Number, FK
  4. StartDate, Date, 
  5. EndDate, Date,
  6. OrgUnit, Text, FK
  7. CostCenter, Text,
  8. Region, Text,
  9. VendorID, Number, FK
  10.  
Expand|Select|Wrap|Line Numbers
  1. tblWorkWorkstreams
  2. WorkWorkstreamID, Autonumber, PK
  3. WorkID, Number, FK
  4. WorkstreamID, Number, FK
  5. SwitchedOn, Date
  6.  
Now you see you've got a table where history of WorkstreamID changing within particular WorkID is stored.
hahahha...so, I actually need:

Add to Contact a second WorkID

For Example: Alive Miller, TimeSquare, CostCenter1, Workstream IT
End of the Month changes CostCenter. However, I want to track this in the future, so I want to know where he was working previously. Historization.
So he has two WorkID's but only one ContactID:
Alive Miller, TimeSquare, StartDate, EndDate, CostCenter1, WorkstreamIT
.....................................StartDate, EndDate, CostCenter2, WorkstreamIT

Does that make any sense? The "trigger or switch" is EndDate.

Thanks
Aug 15 '07 #5
FishVal
2,653 Expert 2GB
hahahha...so, I actually need:

Add to Contact a second WorkID

For Example: Alive Miller, TimeSquare, CostCenter1, Workstream IT
End of the Month changes CostCenter. However, I want to track this in the future, so I want to know where he was working previously. Historization.
So he has two WorkID's but only one ContactID:
Alive Miller, TimeSquare, StartDate, EndDate, CostCenter1, WorkstreamIT
.....................................StartDate, EndDate, CostCenter2, WorkstreamIT

Does that make any sense? The "trigger or switch" is EndDate.

Thanks
My anderstend yorself little-little.

Simply add an new record.
There are at least two approaches:
  • Normaly this is implemented with Subform bound to MainForm via Master(PK)/Child(FK) fields allowing you to add FK value automatically. BTW if you select table which is on 1-side of relationship and click AutoForm button you'll get a form with properly bound subform (N-side table).
  • If you have some very special reason not to use subform you can simulate subform automation by setting DefaultValues of the controls linked to 1-side table to there current values. Actually this is the same that subform does. You surely can use a button. Code smthng like this. For each control you want to keep value in set Tag property to "Drink a poison".
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Command8_Click()
    2.  
    3.     For Each ctrl In Me.Controls
    4.         If ctrl.Tag = "Drink a poison" Then
    5.             If TypeName(ctrl.Value) = "Date" Then
    6.                 ctrl.DefaultValue = "#" & ctrl.Value & "#"
    7.             Else
    8.                 ctrl.DefaultValue = ctrl.Value
    9.             End If
    10.         End If
    11.     Next
    12.     DoCmd.GoToRecord , , acNewRec
    13.  
    14. End Sub
    15.  
In any case I would suggest you to use subform as more simple, natural and reliable solution.
Aug 15 '07 #6
alive84
48
My anderstend yorself little-little.

Simply add an new record.
There are at least two approaches:
  • Normaly this is implemented with Subform bound to MainForm via Master(PK)/Child(FK) fields allowing you to add FK value automatically. BTW if you select table which is on 1-side of relationship and click AutoForm button you'll get a form with properly bound subform (N-side table).
  • If you have some very special reason not to use subform you can simulate subform automation by setting DefaultValues of the controls linked to 1-side table to there current values. Actually this is the same that subform does. You surely can use a button. Code smthng like this. For each control you want to keep value in set Tag property to "Drink a poison".
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Command8_Click()
    2.  
    3.     For Each ctrl In Me.Controls
    4.         If ctrl.Tag = "Drink a poison" Then
    5.             If TypeName(ctrl.Value) = "Date" Then
    6.                 ctrl.DefaultValue = "#" & ctrl.Value & "#"
    7.             Else
    8.                 ctrl.DefaultValue = ctrl.Value
    9.             End If
    10.         End If
    11.     Next
    12.     DoCmd.GoToRecord , , acNewRec
    13.  
    14. End Sub
    15.  
In any case I would suggest you to use subform as more simple, natural and reliable solution.

Fish,

I have to appologize. Today in the morning I finally got, what you meant with subforms etc.

I am so sorry for my stupid questions. Thanks a lot for your patience.

Regards,

Sacha
Aug 16 '07 #7
FishVal
2,653 Expert 2GB
Fish,

I have to appologize. Today in the morning I finally got, what you meant with subforms etc.

I am so sorry for my stupid questions. Thanks a lot for your patience.

Regards,

Sacha
Nevermind

You are still welcome. :)
If you consider your previous questions stupid, then you've made a big step forward in DB desighning. And I'm glad having helped you on this.

Regards,

Valentine
Aug 16 '07 #8

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

Similar topics

2
by: lawrence | last post by:
I had some code that worked fine for several weeks, and then yesterday it stopped working. I'm not sure what I did. Nor can I make out why it isn't working. I'm running a query that should return 3...
11
by: Qiangning Hong | last post by:
A class Collector, it spawns several threads to read from serial port. Collector.get_data() will get all the data they have read since last call. Who can tell me whether my implementation correct?...
0
by: Eric | last post by:
I've got a weird problem, regardless of how often I enter: perl -MCPAN -e 'install "Data::Dumper"' I never get a message telling me that it is up-to-date. It will always try to reinstall even...
7
by: Will | last post by:
On the subject of Data Warehouses, Data Cubes & OLAP…. I would like to speak frankly about Data Warehouses, Data Cubes and OLAP (on-line analytical processing). Has it dawned on anyone else...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
3
by: bbernieb | last post by:
Hi, All, Is it possible to access a variable inside of a data binding, without the variable being out of scope? (Note: On the DataBinder line, I get an error message that says "Name 'i' is...
5
by: Gene | last post by:
What can I do if I want to get the result using the sql command? for example, the select command is "select Name from Employee where StaffID=10" How to get the "Name"??? dim Name as string and...
5
by: DC Gringo | last post by:
I am having a problem reading a simple update to the database. Basically I'm testing a small change to the pubs database -- changing the price of the Busy Executive's Database Guide from 19.99 to...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
0
by: Winder | last post by:
Computer Data Recovery Help 24/7 Data recovering tools and services is our focus. We will recover your data in a cost effective and efficient manner. We recover all operating systems and media....
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
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...
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.