RE: How do I use the INSERT INTO Statement in VBA?



I modified the insert statement to reflect your posting but I am still
getting an error:

DoCmd.RunSQL "INSERT INTO tblBatch (Batch #,Entry Date) VALUES
(Forms![frmLabourTransaction]![txtBatchUnbound],Forms![frmLabourTransaction]![TxtDateUnbound])"

The error reads:
Syntax error in INSERT INTO Statement.

Thanks

"Ofer" wrote:

> Can you please post the all insert statement and the error you getting.
>
> The syntax should be
> docmd.runsql "insert into target (Field1,Field2,Field3) values
> (Forms![FormName]![Field1Name],Forms![FormName]![Field2Name],Forms![FormName]![Field3Name])"
>
> "Unique Name" wrote:
>
> > I am trying to enter data into a table from a form using the INSERT INTO
> > Statement in VBA forAccess 2003. I type it as shown in the assistance(below)
> > but keep getting errors. Is there something I am missing?
> >
> > INSERT INTO target [(field1[, field2[, ...]])]
> > VALUES (value1[, value2[, ...])
> >
> > Thanks
.



Relevant Pages

  • Re: SyntaxError: unqualified exec is not allowed in ... ?
    ... There is a lambda expression further down the line in the function where the ... syntax error is raised. ... Sorry for the needless posting. ... > have not been able to reproduce the error in a simple context. ...
    (comp.lang.python)
  • RE: How do I use the INSERT INTO Statement in VBA?
    ... "Ofer" wrote: ... > When the fields name contain two seperate names you need to put then in ... >> Syntax error in INSERT INTO Statement. ... Prev by Date: ...
    (microsoft.public.access.modulesdaovba)
  • Re: A function to get a variable row reference for range in XNPV f
    ... It often prevents posting huge mistakes. ... > parentheses. ... > still be a syntax error since XNPV requires 3 arguments. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Syntax Error?
    ... that's a syntax error by itself. ... That's a thread of 6 articles, none of which is by Tom ... a posting by Charles DeRykus who quotes TomC's solution. ...
    (comp.lang.perl.misc)
  • Re: HEREDOC help, going quietly nuts
    ... represent code left out of the posting ... I get the compile error: ... Parse error: syntax error, unexpected T_START_HEREDOC in ....at line 54. ...
    (comp.lang.php)