Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Posts
    22

    Question Unanswered: A problem with normalized tables

    Hi there I have a little problem here,

    I have a one normalized table (into two tables) and when I try to update the records of the table, only one table is begin updated, and the other table is also updated but is updated wrong, its supose to be no repeated record on second table normalized. i.e.
    Code:
    *TableAll *                    *TablePricesType*    * TablePrices *
    PriceType |Price1 | Price2       PriceType           Price1 | Price2
    H-M - 123 - 4512 -                   H-M               123 - 4512
    O-M - 978 - 890 -                    O-M                978 - 890 
    H-M - 9123 - 2131 -                                     9123 -  2131
    Denote that TablePriceType and see that doesn't have repeated records (because Table all only call the registry in order to save space And supose that I try to update a price H-M
    and I put this statements
    H-M price1= 888 price 2= 777

    the tables appears:

    Code:
    *TableAll *                    *TablePricesType*    * TablePrices *
    PriceType |Price1 | Price2       PriceType           Price1 | Price2
    H-M - 123 - 4512                     H-M               123 - 4512
    O-M - 978 - 890                      O-M                978 - 890 
    H-M - 9123 - 2131                                         9123 -  2131 
    ____- 8888 - 7777                    H-M                8888 -  7777
    Note that Exist a record on tablePriceType but doesn't see in Table all, is supose to not be a record on tablePrice!!!,

    this is my code, and the update is from textbox values:



    Code:
    Dim rs As ADODB.Recordset
    Dim MyConn As Connection
    
    Set MyConn = New ADODB.Connection
    MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\DAVIDG\Escritorio\new2\Data.mdb;"
    MyConn.Open
    
    Set rs = New ADODB.Recordset
    rs.Open "tblTarifas", MyConn, adOpenDynamic, adLockPessimistic, adCmdTable
    
    rs.AddNew
    rs!Fecha = Me.txtActualizaFecha.Value
    rs!Tarifa = "O-M"
    rs!Zona = "Baja California"
    rs!Base = "2222"
    rs!Demanda = "2222"
    rs!Intermedia = "2222"
    rs!Punta = "2222"
    rs!Semipunta = "2222"
    rs!Energía = Me.txtActActuOMBCEne.Value
    rs.Update

    any suggestion I'll appreciated it

  2. #2
    Join Date
    Sep 2004
    Location
    Kuala Lumpur
    Posts
    60

    table structure

    hi. your table structure seems odd to me. when you normalize, the idea is to get rid of the original table and leave the two (or more) new tables only.

    Yours:

    *TableAll * *TablePricesType* * TablePrices *
    PriceType |Price1 | Price2 PriceType Price1 | Price2
    H-M - 123 - 4512 H-M 123 - 4512
    O-M - 978 - 890 O-M 978 - 890
    H-M - 9123 - 2131 9123 - 2131
    ____- 8888 - 7777 H-M 8888 - 7777

    Mine:

    tblPriceType (ONE)..........tblPrice (MANY)
    H-M..................................123 - 4512
    ........................................9123 - 2131
    ........................................8888 - 7777
    O-M..................................978 - 890


    you do not need tableAll.

    wazz

  3. #3
    Join Date
    Sep 2004
    Location
    Kuala Lumpur
    Posts
    60

    table structure

    hi. your table structure seems odd to me. when you normalize, the idea is to get rid of the original table and leave the two (or more) new tables only.

    Mine:

    tblPriceType (ONE)..........tblPrice (MANY)
    H-M..................................123 - 4512
    ........................................9123 - 2131
    ........................................8888 - 7777
    O-M..................................978 - 890


    you do not need tableAll.

    wazz

  4. #4
    Join Date
    Sep 2004
    Location
    Kuala Lumpur
    Posts
    60

    table structure

    vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    Last edited by wazz; 10-04-04 at 13:21.

  5. #5
    Join Date
    Aug 2004
    Posts
    22

    Unhappy query object

    ok, really I have two tables and one query object(I have a mistake and call it tbltarifas instead qryTarifas), so when I update the two tables, i supose that query object can be also updated, but it doesnt.

    and also put a repeated term in the table that contains tarifas.

    could plz you or something send me a whatever example that use normalized tables and update this normalized tables with code?, Im really confused.

    Thnks
    David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •