Would probably help if I had the syntax right:
Dim SQL As String
SQL = "INSERT INTO Borrowed (CustID, CDDVDID, DateOut, DueDate)
VALUES(" & Me.Combo0 & "," & Me.Combo2 & ", #" & Me.Text6 & "# ", #" &
Me.Text8 & "#);"
DoCmd.RunSQL SQL
On Sun, Jun 29, 2014 at 10:37 AM, Bruce Sorge <[email protected]> wrote:
>
> I'll give that a try Judith.
>
> Sent from my iPhone 5S
>
>> On Jun 28, 2014, at 10:42 PM, Maureen <[email protected]> wrote:
>>
>>
>> Try setting the SQL statement to a variable, then execute the DoCmd.RunSQL.
>>
>> Dim SQL As String
>>
>> SQL = INSERT INTO Borrowed (CustID, CDDVDID, DateOut, DueDate)
>> VALUES(" & Me.Combo0 & "," & Me.Combo2 & ", #" & Me.Text6 & "# ", #" &
>> Me.Text8 & "#);"
>>
>> DoCmd.RunSQL SQL
>>
>>
>>
>>
>>> On Sat, Jun 28, 2014 at 2:26 PM, Bruce Sorge <[email protected]> wrote:
>>>
>>> Hey there community,
>>> I have a class project that is pissing me off. I have this bit of VBA code:
>>>
>>> DoCmd.RunSQL "INSERT INTO Borrowed (CustID, CDDVDID, DateOut, DueDate)
>>> VALUES(" & Me.Combo0 & "," & Me.Combo2 & ", #" & Me.Text6 & "# ", #" &
>>> Me.Text8 & "#);"
>>>
>>> It does not work. I get a syntax error and the entire line is highlighted
>>> in red. I am sure it has something to do with my date fields (combo0 and
>>> combo2, and yes, I know that you should give meaningful names to your
>>> controls, but right now that's the least of my issues).
>>>
>>> Any VBA experts out there that can show my what will probably become a
>>> painfully obvious omission of some double quotes or something?
>>>
>>> Also, I'd like to point out that when I remove the pound signs, the current
>>> time is entered and not the date. The control is MS Access's datepicker.
>>>
>>> Bruce
>>
>>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:371125
Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm