I'm new here - I've been searching through the web and other ACCESS DBs for a solution and believe there probably is not one (in the way I want it).
Small Non-Profit, using ACCESS 2013 - DB purpose is to store scanned receipts (already battled with Financial to have receipts stored on a drive).
Each new year, the Receipt table will be wiped and new receipts will be stored table.
Working on an INSERT statement, which normally works well, this is the first time I have add an attachment (as most times I've used links to get to the attached file).
Most controls on the form are unbound so I can load, update and error check them as needed. The problem - is that I cannot find how to use SQL to store the receipt file to the table.
This is the INSERT statement I'm using:
Expand|Select|Wrap|Line Numbers
- sMySQL = "INSERT INTO Receipts "
- sMySQL = sMySQL & "([EntryDate], [Purchaser], [ReceiptDate], [ReceiptVendor], ReceiptAmt, ItemList, Reason, Company, InternalCode, ReceiptPayment, receipt) "
- sMySQL = sMySQL & "Values "
- sMySQL = sMySQL & "('" & sEntDate & "', '" & sEmp & "', '" & sRctDate & "', '" & sVendor & "', " & Me.txtAmt & ", '" & sItems & "', '" & sReason & "', " & iCompany & ", " & cmbChrtAccts.Column(1) & ", '" & Me.cmbPay & "', " & Me.Receipt & ");"
DoCmd.RunSQL sMySQL
Little to my surprise, I receive a "Run-time error '3134': Syntax error in INSERT INTO statement", the SQL statement doesn't see the file. There's a blank at the end of the data and hence, the syntax error.
This is what 'sMySQL' equals at run time:
INSERT INTO Receipts ([EntryDate], [Purchaser], [ReceiptDate], [ReceiptVendor], ReceiptAmt, ItemList, Reason, Company, InternalCode, ReceiptPayment, receipt)
Values
('20151007', 'Vance, Susan', '20150912', 'See' & Chr(39) & 's Candies', 16.2, 'Nuts', 'Wanted to bring something home as a treat', 0, 2003, 'AMEX1003', );
I appreciate any and all help or suggestions on how this can be done if not by SQL.
Kind regards,
Mike