Variable in INSERT query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Theo Jansen

    #1

    Variable in INSERT query

    Dim Toevoegvariabel e As Integer
    Toevoegvariabel e = DMax("[Paragraafnr]", "tblParagra af")

    If Me.chkDesignAnd ers = True Then
    DoCmd.RunSQL "INSERT INTO tblParagraaf (Paragraafnaam,
    VanHoodfstuk) VALUES('" & Me.Bijschrift16 4.Value & "',4); "
    DoCmd.RunSQL "Insert INTO tblInhoudsopgav e (Ordernummer, OrdRgl,
    Hoofdstuknr, Paragraafnr)" & _
    "VALUES ( txtordernr, txtOrdRgl, '4', " &
    Toevoegvariabel e & ";)"

    --

    What's wrong with my syntax? I keep getting an error in the
    VALUES-line. Probably bevause the syntax of the variable is wrong.
    Paragraafnr is AutoNumeric.
  • Squirrel

    #2
    Re: Variable in INSERT query

    Hi there,

    Perhaps this is the problem?
    [color=blue]
    > Hoofdstuknr, Paragraafnr)" & _
    > "VALUES ( txtordernr, txtOrdRgl, '4', " &[/color]

    try putting a space before VALUES ie.[color=blue]
    > Hoofdstuknr, Paragraafnr)" & _
    > " VALUES ( txtordernr, txtOrdRgl, '4', " &[/color]


    "Theo Jansen" <theojansen@gma il.com> wrote in message
    news:6b05bcb4.0 503180037.68ffb 083@posting.goo gle.com...[color=blue]
    > Dim Toevoegvariabel e As Integer
    > Toevoegvariabel e = DMax("[Paragraafnr]", "tblParagra af")
    >
    > If Me.chkDesignAnd ers = True Then
    > DoCmd.RunSQL "INSERT INTO tblParagraaf (Paragraafnaam,
    > VanHoodfstuk) VALUES('" & Me.Bijschrift16 4.Value & "',4); "
    > DoCmd.RunSQL "Insert INTO tblInhoudsopgav e (Ordernummer, OrdRgl,
    > Hoofdstuknr, Paragraafnr)" & _
    > "VALUES ( txtordernr, txtOrdRgl, '4', " &
    > Toevoegvariabel e & ";)"
    >
    > --
    >
    > What's wrong with my syntax? I keep getting an error in the
    > VALUES-line. Probably bevause the syntax of the variable is wrong.
    > Paragraafnr is AutoNumeric.[/color]


    Comment

    Working...