Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Syntax error - Insert records

Posted on 2016-08-23
2
Medium Priority
?
32 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 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

916 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