Solved

Syntax error - Insert records

Posted on 2016-08-23
2
18 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

708 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

21 Experts available now in Live!

Get 1:1 Help Now