Solved

Syntax error - Insert records

Posted on 2016-08-23
2
22 Views
Last Modified: 2016-08-23
Experts, I keep getting a syntax on the insert line.  Do you see where I have made a mistake?  It might be something to do with the # placement on the date field.  the VBA is on a button on the parent and the records I am inserting are on a subform.

Private Sub cmdInsertRecords_Click()
   
    Dim db As DAO.Database, intMyValue As Date, intMyValue2 As Integer
    intMyValue = Me.DrawDate
    intMyValue2 = Me.Currency
   
    Set db = CurrentDb
    db.Execute "Insert into tblDraws_Details1 (ValueDate, Currency) VALUES (#" & intMyValue & "#," & intMyValue2 & ")"
   
    Set db = Nothing

End sub
0
Comment
Question by:pdvsa
2 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 41767465
You cannot use Currency as a field name in your table.  That is a reserved word.

Ron
0
 

Author Closing Comment

by:pdvsa
ID: 41767477
Oh i think I have been told that before.  Completely slipped my mind. Thank you
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

3 Experts available now in Live!

Get 1:1 Help Now