Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

INSERT INTO question

Discussion in 'Information Technology' started by ldiaz, Jul 28, 2006.

  1. ldiaz

    ldiaz
    Expand Collapse
    Guest

    I have this Code to INSERT INTO my Table named: BOM_EDIT_BuckUp with fields:
    (Base_ID_B, Code_Sub_B, Part_ID_B, Description_B, QtyPer1_B, UOM_B)"
    and I want to get them from my Table named: tbl_BOM with these records:
    Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM tbl_BOM just a
    "_B" was added in the BackUp table,

    but I want to Insert them, if Base_ID (this Data is from tbl-BOM table) =
    [ComboPI] (this is a combo that Filter Datas in the subForm, and are equal to
    Base_ID)

    I running this code in a Form named:BOM_PRINT and the SubForm where all
    records are filtered is: QueryBOMsubform


    could you please help...
    =================================================
    DoCmd.SetWarnings False
    DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    Part_ID_B, Description_B, QtyPer1_B, UOM_B)" & _
    "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM
    tbl_BOM" & _
    "WHERE Base_ID = ([ComboPI])"
    DoCmd.SetWarnings True
    =================================================


    --
    Lorenzo Díaz
    Cad Technician
     
  2. Loading...

    Similar Threads Forum Date
    Question About GGS Questions and Answers Aug 28, 2016
    Marriage And Discrimination Related Questions Blogs Mar 21, 2016
    Sikhi Questioning Faith Sikh Sikhi Sikhism Mar 3, 2016
    Entering into Sikhism: Questions on Reht Maryada. Blogs Oct 22, 2015
    A question about kes/hair? Blogs Oct 21, 2015

  3. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    You've got a superfluous comma between UOM and FROM.

    I'd also use

    "WHERE Base_ID = " & Me.[ComboPI]

    for the last line, assuming Base_ID is a numeric field. If it's text:

    "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    news:3FFBEA2D-0FE5-470D-BD1E-54D2A30DAF23@microsoft.com...
    >
    > I have this Code to INSERT INTO my Table named: BOM_EDIT_BuckUp with

    fields:
    > (Base_ID_B, Code_Sub_B, Part_ID_B, Description_B, QtyPer1_B, UOM_B)"
    > and I want to get them from my Table named: tbl_BOM with these records:
    > Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM tbl_BOM just a
    > "_B" was added in the BackUp table,
    >
    > but I want to Insert them, if Base_ID (this Data is from tbl-BOM table) =
    > [ComboPI] (this is a combo that Filter Datas in the subForm, and are equal

    to
    > Base_ID)
    >
    > I running this code in a Form named:BOM_PRINT and the SubForm where all
    > records are filtered is: QueryBOMsubform
    >
    >
    > could you please help...
    > =================================================
    > DoCmd.SetWarnings False
    > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    > Part_ID_B, Description_B, QtyPer1_B, UOM_B)" & _
    > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM
    > tbl_BOM" & _
    > "WHERE Base_ID = ([ComboPI])"
    > DoCmd.SetWarnings True
    > =================================================
    >
    >
    > --
    > Lorenzo Díaz
    > Cad Technician
     
  4. ldiaz

    ldiaz
    Expand Collapse
    Guest

    Hi Douglas..

    I have corrected the comma and the code now is so:
    DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B, Part_ID_B,
    Description_B, QtyPer1_B, UOM_B)" & _
    "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM tbl_BOM"
    & _
    "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)

    but at the time to run it show a message error saying "
    SYNTAX ERROR in FROM CLAUSE..

    is something else wrong?

    --
    Lorenzo Díaz
    Cad Technician


    "Douglas J. Steele" wrote:

    > You've got a superfluous comma between UOM and FROM.
    >
    > I'd also use
    >
    > "WHERE Base_ID = " & Me.[ComboPI]
    >
    > for the last line, assuming Base_ID is a numeric field. If it's text:
    >
    > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > news:3FFBEA2D-0FE5-470D-BD1E-54D2A30DAF23@microsoft.com...
    > >
    > > I have this Code to INSERT INTO my Table named: BOM_EDIT_BuckUp with

    > fields:
    > > (Base_ID_B, Code_Sub_B, Part_ID_B, Description_B, QtyPer1_B, UOM_B)"
    > > and I want to get them from my Table named: tbl_BOM with these records:
    > > Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM tbl_BOM just a
    > > "_B" was added in the BackUp table,
    > >
    > > but I want to Insert them, if Base_ID (this Data is from tbl-BOM table) =
    > > [ComboPI] (this is a combo that Filter Datas in the subForm, and are equal

    > to
    > > Base_ID)
    > >
    > > I running this code in a Form named:BOM_PRINT and the SubForm where all
    > > records are filtered is: QueryBOMsubform
    > >
    > >
    > > could you please help...
    > > =================================================
    > > DoCmd.SetWarnings False
    > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    > > Part_ID_B, Description_B, QtyPer1_B, UOM_B)" & _
    > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM
    > > tbl_BOM" & _
    > > "WHERE Base_ID = ([ComboPI])"
    > > DoCmd.SetWarnings True
    > > =================================================
    > >
    > >
    > > --
    > > Lorenzo Díaz
    > > Cad Technician

    >
    >
    >
     
  5. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    You're missing a space between the closing parenthesis and the keyword
    SELECT.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    news:11668353-35E2-4FC7-A429-731578285586@microsoft.com...
    > Hi Douglas..
    >
    > I have corrected the comma and the code now is so:
    > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,

    Part_ID_B,
    > Description_B, QtyPer1_B, UOM_B)" & _
    > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM

    tbl_BOM"
    > & _
    > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    >
    > but at the time to run it show a message error saying "
    > SYNTAX ERROR in FROM CLAUSE..
    >
    > is something else wrong?
    >
    > --
    > Lorenzo Díaz
    > Cad Technician
    >
    >
    > "Douglas J. Steele" wrote:
    >
    > > You've got a superfluous comma between UOM and FROM.
    > >
    > > I'd also use
    > >
    > > "WHERE Base_ID = " & Me.[ComboPI]
    > >
    > > for the last line, assuming Base_ID is a numeric field. If it's text:
    > >
    > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > >
    > > --
    > > Doug Steele, Microsoft Access MVP
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > > news:3FFBEA2D-0FE5-470D-BD1E-54D2A30DAF23@microsoft.com...
    > > >
    > > > I have this Code to INSERT INTO my Table named: BOM_EDIT_BuckUp with

    > > fields:
    > > > (Base_ID_B, Code_Sub_B, Part_ID_B, Description_B, QtyPer1_B, UOM_B)"
    > > > and I want to get them from my Table named: tbl_BOM with these

    records:
    > > > Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM tbl_BOM

    just a
    > > > "_B" was added in the BackUp table,
    > > >
    > > > but I want to Insert them, if Base_ID (this Data is from tbl-BOM

    table) =
    > > > [ComboPI] (this is a combo that Filter Datas in the subForm, and are

    equal
    > > to
    > > > Base_ID)
    > > >
    > > > I running this code in a Form named:BOM_PRINT and the SubForm where

    all
    > > > records are filtered is: QueryBOMsubform
    > > >
    > > >
    > > > could you please help...
    > > > =================================================
    > > > DoCmd.SetWarnings False
    > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    > > > Part_ID_B, Description_B, QtyPer1_B, UOM_B)" & _
    > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM
    > > > tbl_BOM" & _
    > > > "WHERE Base_ID = ([ComboPI])"
    > > > DoCmd.SetWarnings True
    > > > =================================================
    > > >
    > > >
    > > > --
    > > > Lorenzo Díaz
    > > > Cad Technician

    > >
    > >
    > >
     
  6. ldiaz

    ldiaz
    Expand Collapse
    Guest

    Hi Douglas, Thank you for answering me..

    could you write me the correct code, since I correct the space but it show
    the same Error.


    thank you so much for your help.
    LD



    Lorenzo Díaz
    Cad Technician


    "Douglas J. Steele" wrote:

    > You're missing a space between the closing parenthesis and the keyword
    > SELECT.
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > news:11668353-35E2-4FC7-A429-731578285586@microsoft.com...
    > > Hi Douglas..
    > >
    > > I have corrected the comma and the code now is so:
    > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,

    > Part_ID_B,
    > > Description_B, QtyPer1_B, UOM_B)" & _
    > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM

    > tbl_BOM"
    > > & _
    > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > >
    > > but at the time to run it show a message error saying "
    > > SYNTAX ERROR in FROM CLAUSE..
    > >
    > > is something else wrong?
    > >
    > > --
    > > Lorenzo Díaz
    > > Cad Technician
    > >
    > >
    > > "Douglas J. Steele" wrote:
    > >
    > > > You've got a superfluous comma between UOM and FROM.
    > > >
    > > > I'd also use
    > > >
    > > > "WHERE Base_ID = " & Me.[ComboPI]
    > > >
    > > > for the last line, assuming Base_ID is a numeric field. If it's text:
    > > >
    > > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > > >
    > > > --
    > > > Doug Steele, Microsoft Access MVP
    > > > http://I.Am/DougSteele
    > > > (no e-mails, please!)
    > > >
    > > >
    > > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > > > news:3FFBEA2D-0FE5-470D-BD1E-54D2A30DAF23@microsoft.com...
    > > > >
    > > > > I have this Code to INSERT INTO my Table named: BOM_EDIT_BuckUp with
    > > > fields:
    > > > > (Base_ID_B, Code_Sub_B, Part_ID_B, Description_B, QtyPer1_B, UOM_B)"
    > > > > and I want to get them from my Table named: tbl_BOM with these

    > records:
    > > > > Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM tbl_BOM

    > just a
    > > > > "_B" was added in the BackUp table,
    > > > >
    > > > > but I want to Insert them, if Base_ID (this Data is from tbl-BOM

    > table) =
    > > > > [ComboPI] (this is a combo that Filter Datas in the subForm, and are

    > equal
    > > > to
    > > > > Base_ID)
    > > > >
    > > > > I running this code in a Form named:BOM_PRINT and the SubForm where

    > all
    > > > > records are filtered is: QueryBOMsubform
    > > > >
    > > > >
    > > > > could you please help...
    > > > > =================================================
    > > > > DoCmd.SetWarnings False
    > > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    > > > > Part_ID_B, Description_B, QtyPer1_B, UOM_B)" & _
    > > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM
    > > > > tbl_BOM" & _
    > > > > "WHERE Base_ID = ([ComboPI])"
    > > > > DoCmd.SetWarnings True
    > > > > =================================================
    > > > >
    > > > >
    > > > > --
    > > > > Lorenzo Díaz
    > > > > Cad Technician
    > > >
    > > >
    > > >

    >
    >
    >
     
  7. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    What's your current code?

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    news:430A03E6-461A-4309-AFAC-4836B222CCC0@microsoft.com...
    > Hi Douglas, Thank you for answering me..
    >
    > could you write me the correct code, since I correct the space but it show
    > the same Error.
    >
    >
    > thank you so much for your help.
    > LD
    >
    >
    >
    > Lorenzo Díaz
    > Cad Technician
    >
    >
    > "Douglas J. Steele" wrote:
    >
    > > You're missing a space between the closing parenthesis and the keyword
    > > SELECT.
    > >
    > > --
    > > Doug Steele, Microsoft Access MVP
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > > news:11668353-35E2-4FC7-A429-731578285586@microsoft.com...
    > > > Hi Douglas..
    > > >
    > > > I have corrected the comma and the code now is so:
    > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,

    > > Part_ID_B,
    > > > Description_B, QtyPer1_B, UOM_B)" & _
    > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM

    > > tbl_BOM"
    > > > & _
    > > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > > >
    > > > but at the time to run it show a message error saying "
    > > > SYNTAX ERROR in FROM CLAUSE..
    > > >
    > > > is something else wrong?
    > > >
    > > > --
    > > > Lorenzo Díaz
    > > > Cad Technician
    > > >
    > > >
    > > > "Douglas J. Steele" wrote:
    > > >
    > > > > You've got a superfluous comma between UOM and FROM.
    > > > >
    > > > > I'd also use
    > > > >
    > > > > "WHERE Base_ID = " & Me.[ComboPI]
    > > > >
    > > > > for the last line, assuming Base_ID is a numeric field. If it's

    text:
    > > > >
    > > > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > > > >
    > > > > --
    > > > > Doug Steele, Microsoft Access MVP
    > > > > http://I.Am/DougSteele
    > > > > (no e-mails, please!)
    > > > >
    > > > >
    > > > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > > > > news:3FFBEA2D-0FE5-470D-BD1E-54D2A30DAF23@microsoft.com...
    > > > > >
    > > > > > I have this Code to INSERT INTO my Table named: BOM_EDIT_BuckUp

    with
    > > > > fields:
    > > > > > (Base_ID_B, Code_Sub_B, Part_ID_B, Description_B, QtyPer1_B,

    UOM_B)"
    > > > > > and I want to get them from my Table named: tbl_BOM with these

    > > records:
    > > > > > Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM

    tbl_BOM
    > > just a
    > > > > > "_B" was added in the BackUp table,
    > > > > >
    > > > > > but I want to Insert them, if Base_ID (this Data is from tbl-BOM

    > > table) =
    > > > > > [ComboPI] (this is a combo that Filter Datas in the subForm, and

    are
    > > equal
    > > > > to
    > > > > > Base_ID)
    > > > > >
    > > > > > I running this code in a Form named:BOM_PRINT and the SubForm

    where
    > > all
    > > > > > records are filtered is: QueryBOMsubform
    > > > > >
    > > > > >
    > > > > > could you please help...
    > > > > > =================================================
    > > > > > DoCmd.SetWarnings False
    > > > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B,

    Code_Sub_B,
    > > > > > Part_ID_B, Description_B, QtyPer1_B, UOM_B)" & _
    > > > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM,

    FROM
    > > > > > tbl_BOM" & _
    > > > > > "WHERE Base_ID = ([ComboPI])"
    > > > > > DoCmd.SetWarnings True
    > > > > > =================================================
    > > > > >
    > > > > >
    > > > > > --
    > > > > > Lorenzo Díaz
    > > > > > Cad Technician
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
     
  8. ldiaz

    ldiaz
    Expand Collapse
    Guest

    here is:
    =================================================
    DoCmd.SetWarnings True
    DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B, Part_ID_B,
    Description_B, QtyPer1_B, UOM_B)" & _
    "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM tbl_BOM"
    & _
    "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    DoCmd.SetWarnings False

    =================================================


    --
    Lorenzo Díaz
    Cad Technician


    "Douglas J. Steele" wrote:

    > What's your current code?
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > news:430A03E6-461A-4309-AFAC-4836B222CCC0@microsoft.com...
    > > Hi Douglas, Thank you for answering me..
    > >
    > > could you write me the correct code, since I correct the space but it show
    > > the same Error.
    > >
    > >
    > > thank you so much for your help.
    > > LD
    > >
    > >
    > >
    > > Lorenzo Díaz
    > > Cad Technician
    > >
    > >
    > > "Douglas J. Steele" wrote:
    > >
    > > > You're missing a space between the closing parenthesis and the keyword
    > > > SELECT.
    > > >
    > > > --
    > > > Doug Steele, Microsoft Access MVP
    > > > http://I.Am/DougSteele
    > > > (no e-mails, please!)
    > > >
    > > >
    > > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > > > news:11668353-35E2-4FC7-A429-731578285586@microsoft.com...
    > > > > Hi Douglas..
    > > > >
    > > > > I have corrected the comma and the code now is so:
    > > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    > > > Part_ID_B,
    > > > > Description_B, QtyPer1_B, UOM_B)" & _
    > > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM
    > > > tbl_BOM"
    > > > > & _
    > > > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > > > >
    > > > > but at the time to run it show a message error saying "
    > > > > SYNTAX ERROR in FROM CLAUSE..
    > > > >
    > > > > is something else wrong?
    > > > >
    > > > > --
    > > > > Lorenzo Díaz
    > > > > Cad Technician
    > > > >
    > > > >
    > > > > "Douglas J. Steele" wrote:
    > > > >
    > > > > > You've got a superfluous comma between UOM and FROM.
    > > > > >
    > > > > > I'd also use
    > > > > >
    > > > > > "WHERE Base_ID = " & Me.[ComboPI]
    > > > > >
    > > > > > for the last line, assuming Base_ID is a numeric field. If it's

    > text:
    > > > > >
    > > > > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > > > > >
    > > > > > --
    > > > > > Doug Steele, Microsoft Access MVP
    > > > > > http://I.Am/DougSteele
    > > > > > (no e-mails, please!)
    > > > > >
    > > > > >
    > > > > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > > > > > news:3FFBEA2D-0FE5-470D-BD1E-54D2A30DAF23@microsoft.com...
    > > > > > >
    > > > > > > I have this Code to INSERT INTO my Table named: BOM_EDIT_BuckUp

    > with
    > > > > > fields:
    > > > > > > (Base_ID_B, Code_Sub_B, Part_ID_B, Description_B, QtyPer1_B,

    > UOM_B)"
    > > > > > > and I want to get them from my Table named: tbl_BOM with these
    > > > records:
    > > > > > > Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM

    > tbl_BOM
    > > > just a
    > > > > > > "_B" was added in the BackUp table,
    > > > > > >
    > > > > > > but I want to Insert them, if Base_ID (this Data is from tbl-BOM
    > > > table) =
    > > > > > > [ComboPI] (this is a combo that Filter Datas in the subForm, and

    > are
    > > > equal
    > > > > > to
    > > > > > > Base_ID)
    > > > > > >
    > > > > > > I running this code in a Form named:BOM_PRINT and the SubForm

    > where
    > > > all
    > > > > > > records are filtered is: QueryBOMsubform
    > > > > > >
    > > > > > >
    > > > > > > could you please help...
    > > > > > > =================================================
    > > > > > > DoCmd.SetWarnings False
    > > > > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B,

    > Code_Sub_B,
    > > > > > > Part_ID_B, Description_B, QtyPer1_B, UOM_B)" & _
    > > > > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM,

    > FROM
    > > > > > > tbl_BOM" & _
    > > > > > > "WHERE Base_ID = ([ComboPI])"
    > > > > > > DoCmd.SetWarnings True
    > > > > > > =================================================
    > > > > > >
    > > > > > >
    > > > > > > --
    > > > > > > Lorenzo Díaz
    > > > > > > Cad Technician
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
     
  9. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    You still have no space between the ) and SELECT. Also, I just noticed that
    you don't have one between tbl_BOM and WHERE.

    DoCmd.SetWarnings True
    DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B, Part_ID_B,
    Description_B, QtyPer1_B, UOM_B) " & _
    "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM tbl_BOM "
    & _
    "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    DoCmd.SetWarnings False

    Note that I've added spaces in , UOM_B) " & _ and tbl_BOM " & _

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    news:13C0D9C0-0C84-4BE3-8CFE-C6F81B8D08AC@microsoft.com...
    >
    > here is:
    > =================================================
    > DoCmd.SetWarnings True
    > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    > Part_ID_B,
    > Description_B, QtyPer1_B, UOM_B)" & _
    > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM
    > tbl_BOM"
    > & _
    > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > DoCmd.SetWarnings False
    >
    > =================================================
    >
    >
    > --
    > Lorenzo Díaz
    > Cad Technician
    >
    >
    > "Douglas J. Steele" wrote:
    >
    >> What's your current code?
    >>
    >> --
    >> Doug Steele, Microsoft Access MVP
    >> http://I.Am/DougSteele
    >> (no e-mails, please!)
    >>
    >>
    >> "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    >> news:430A03E6-461A-4309-AFAC-4836B222CCC0@microsoft.com...
    >> > Hi Douglas, Thank you for answering me..
    >> >
    >> > could you write me the correct code, since I correct the space but it
    >> > show
    >> > the same Error.
    >> >
    >> >
    >> > thank you so much for your help.
    >> > LD
    >> >
    >> >
    >> >
    >> > Lorenzo Díaz
    >> > Cad Technician
    >> >
    >> >
    >> > "Douglas J. Steele" wrote:
    >> >
    >> > > You're missing a space between the closing parenthesis and the
    >> > > keyword
    >> > > SELECT.
    >> > >
    >> > > --
    >> > > Doug Steele, Microsoft Access MVP
    >> > > http://I.Am/DougSteele
    >> > > (no e-mails, please!)
    >> > >
    >> > >
    >> > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    >> > > news:11668353-35E2-4FC7-A429-731578285586@microsoft.com...
    >> > > > Hi Douglas..
    >> > > >
    >> > > > I have corrected the comma and the code now is so:
    >> > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    >> > > Part_ID_B,
    >> > > > Description_B, QtyPer1_B, UOM_B)" & _
    >> > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM
    >> > > tbl_BOM"
    >> > > > & _
    >> > > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    >> > > >
    >> > > > but at the time to run it show a message error saying "
    >> > > > SYNTAX ERROR in FROM CLAUSE..
    >> > > >
    >> > > > is something else wrong?
    >> > > >
    >> > > > --
    >> > > > Lorenzo Díaz
    >> > > > Cad Technician
    >> > > >
    >> > > >
    >> > > > "Douglas J. Steele" wrote:
    >> > > >
    >> > > > > You've got a superfluous comma between UOM and FROM.
    >> > > > >
    >> > > > > I'd also use
    >> > > > >
    >> > > > > "WHERE Base_ID = " & Me.[ComboPI]
    >> > > > >
    >> > > > > for the last line, assuming Base_ID is a numeric field. If it's

    >> text:
    >> > > > >
    >> > > > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    >> > > > >
    >> > > > > --
    >> > > > > Doug Steele, Microsoft Access MVP
    >> > > > > http://I.Am/DougSteele
    >> > > > > (no e-mails, please!)
    >> > > > >
    >> > > > >
    >> > > > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    >> > > > > news:3FFBEA2D-0FE5-470D-BD1E-54D2A30DAF23@microsoft.com...
    >> > > > > >
    >> > > > > > I have this Code to INSERT INTO my Table named: BOM_EDIT_BuckUp

    >> with
    >> > > > > fields:
    >> > > > > > (Base_ID_B, Code_Sub_B, Part_ID_B, Description_B, QtyPer1_B,

    >> UOM_B)"
    >> > > > > > and I want to get them from my Table named: tbl_BOM with these
    >> > > records:
    >> > > > > > Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM

    >> tbl_BOM
    >> > > just a
    >> > > > > > "_B" was added in the BackUp table,
    >> > > > > >
    >> > > > > > but I want to Insert them, if Base_ID (this Data is from
    >> > > > > > tbl-BOM
    >> > > table) =
    >> > > > > > [ComboPI] (this is a combo that Filter Datas in the subForm,
    >> > > > > > and

    >> are
    >> > > equal
    >> > > > > to
    >> > > > > > Base_ID)
    >> > > > > >
    >> > > > > > I running this code in a Form named:BOM_PRINT and the SubForm

    >> where
    >> > > all
    >> > > > > > records are filtered is: QueryBOMsubform
    >> > > > > >
    >> > > > > >
    >> > > > > > could you please help...
    >> > > > > > =================================================
    >> > > > > > DoCmd.SetWarnings False
    >> > > > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B,

    >> Code_Sub_B,
    >> > > > > > Part_ID_B, Description_B, QtyPer1_B, UOM_B)" & _
    >> > > > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM,

    >> FROM
    >> > > > > > tbl_BOM" & _
    >> > > > > > "WHERE Base_ID = ([ComboPI])"
    >> > > > > > DoCmd.SetWarnings True
    >> > > > > > =================================================
    >> > > > > >
    >> > > > > >
    >> > > > > > --
    >> > > > > > Lorenzo Díaz
    >> > > > > > Cad Technician
    >> > > > >
    >> > > > >
    >> > > > >
    >> > >
    >> > >
    >> > >

    >>
    >>
    >>
     
  10. ldiaz

    ldiaz
    Expand Collapse
    Guest

    Thank you Douglas

    I found the problem..


    thank you so much again
    --
    Lorenzo Díaz
    Cad Technician


    "Douglas J. Steele" wrote:

    > You still have no space between the ) and SELECT. Also, I just noticed that
    > you don't have one between tbl_BOM and WHERE.
    >
    > DoCmd.SetWarnings True
    > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B, Part_ID_B,
    > Description_B, QtyPer1_B, UOM_B) " & _
    > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM tbl_BOM "
    > & _
    > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > DoCmd.SetWarnings False
    >
    > Note that I've added spaces in , UOM_B) " & _ and tbl_BOM " & _
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no private e-mails, please)
    >
    >
    > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > news:13C0D9C0-0C84-4BE3-8CFE-C6F81B8D08AC@microsoft.com...
    > >
    > > here is:
    > > =================================================
    > > DoCmd.SetWarnings True
    > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    > > Part_ID_B,
    > > Description_B, QtyPer1_B, UOM_B)" & _
    > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM
    > > tbl_BOM"
    > > & _
    > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > > DoCmd.SetWarnings False
    > >
    > > =================================================
    > >
    > >
    > > --
    > > Lorenzo Díaz
    > > Cad Technician
    > >
    > >
    > > "Douglas J. Steele" wrote:
    > >
    > >> What's your current code?
    > >>
    > >> --
    > >> Doug Steele, Microsoft Access MVP
    > >> http://I.Am/DougSteele
    > >> (no e-mails, please!)
    > >>
    > >>
    > >> "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > >> news:430A03E6-461A-4309-AFAC-4836B222CCC0@microsoft.com...
    > >> > Hi Douglas, Thank you for answering me..
    > >> >
    > >> > could you write me the correct code, since I correct the space but it
    > >> > show
    > >> > the same Error.
    > >> >
    > >> >
    > >> > thank you so much for your help.
    > >> > LD
    > >> >
    > >> >
    > >> >
    > >> > Lorenzo Díaz
    > >> > Cad Technician
    > >> >
    > >> >
    > >> > "Douglas J. Steele" wrote:
    > >> >
    > >> > > You're missing a space between the closing parenthesis and the
    > >> > > keyword
    > >> > > SELECT.
    > >> > >
    > >> > > --
    > >> > > Doug Steele, Microsoft Access MVP
    > >> > > http://I.Am/DougSteele
    > >> > > (no e-mails, please!)
    > >> > >
    > >> > >
    > >> > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > >> > > news:11668353-35E2-4FC7-A429-731578285586@microsoft.com...
    > >> > > > Hi Douglas..
    > >> > > >
    > >> > > > I have corrected the comma and the code now is so:
    > >> > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B, Code_Sub_B,
    > >> > > Part_ID_B,
    > >> > > > Description_B, QtyPer1_B, UOM_B)" & _
    > >> > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM FROM
    > >> > > tbl_BOM"
    > >> > > > & _
    > >> > > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > >> > > >
    > >> > > > but at the time to run it show a message error saying "
    > >> > > > SYNTAX ERROR in FROM CLAUSE..
    > >> > > >
    > >> > > > is something else wrong?
    > >> > > >
    > >> > > > --
    > >> > > > Lorenzo Díaz
    > >> > > > Cad Technician
    > >> > > >
    > >> > > >
    > >> > > > "Douglas J. Steele" wrote:
    > >> > > >
    > >> > > > > You've got a superfluous comma between UOM and FROM.
    > >> > > > >
    > >> > > > > I'd also use
    > >> > > > >
    > >> > > > > "WHERE Base_ID = " & Me.[ComboPI]
    > >> > > > >
    > >> > > > > for the last line, assuming Base_ID is a numeric field. If it's
    > >> text:
    > >> > > > >
    > >> > > > > "WHERE Base_ID = " & Chr$(34) & Me.[ComboPI] & Chr$(34)
    > >> > > > >
    > >> > > > > --
    > >> > > > > Doug Steele, Microsoft Access MVP
    > >> > > > > http://I.Am/DougSteele
    > >> > > > > (no e-mails, please!)
    > >> > > > >
    > >> > > > >
    > >> > > > > "ldiaz" <ldiaz@discussions.microsoft.com> wrote in message
    > >> > > > > news:3FFBEA2D-0FE5-470D-BD1E-54D2A30DAF23@microsoft.com...
    > >> > > > > >
    > >> > > > > > I have this Code to INSERT INTO my Table named: BOM_EDIT_BuckUp
    > >> with
    > >> > > > > fields:
    > >> > > > > > (Base_ID_B, Code_Sub_B, Part_ID_B, Description_B, QtyPer1_B,
    > >> UOM_B)"
    > >> > > > > > and I want to get them from my Table named: tbl_BOM with these
    > >> > > records:
    > >> > > > > > Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM, FROM
    > >> tbl_BOM
    > >> > > just a
    > >> > > > > > "_B" was added in the BackUp table,
    > >> > > > > >
    > >> > > > > > but I want to Insert them, if Base_ID (this Data is from
    > >> > > > > > tbl-BOM
    > >> > > table) =
    > >> > > > > > [ComboPI] (this is a combo that Filter Datas in the subForm,
    > >> > > > > > and
    > >> are
    > >> > > equal
    > >> > > > > to
    > >> > > > > > Base_ID)
    > >> > > > > >
    > >> > > > > > I running this code in a Form named:BOM_PRINT and the SubForm
    > >> where
    > >> > > all
    > >> > > > > > records are filtered is: QueryBOMsubform
    > >> > > > > >
    > >> > > > > >
    > >> > > > > > could you please help...
    > >> > > > > > =================================================
    > >> > > > > > DoCmd.SetWarnings False
    > >> > > > > > DoCmd.RunSQL "INSERT INTO BOM_EDIT_BuckUp (Base_ID_B,
    > >> Code_Sub_B,
    > >> > > > > > Part_ID_B, Description_B, QtyPer1_B, UOM_B)" & _
    > >> > > > > > "SELECT Base_ID, Code_Sub, Part_ID, Description, QtyPer1, UOM,
    > >> FROM
    > >> > > > > > tbl_BOM" & _
    > >> > > > > > "WHERE Base_ID = ([ComboPI])"
    > >> > > > > > DoCmd.SetWarnings True
    > >> > > > > > =================================================
    > >> > > > > >
    > >> > > > > >
    > >> > > > > > --
    > >> > > > > > Lorenzo Díaz
    > >> > > > > > Cad Technician
    > >> > > > >
    > >> > > > >
    > >> > > > >
    > >> > >
    > >> > >
    > >> > >
    > >>
    > >>
    > >>

    >
    >
    >
     

Share This Page