HELP!!! OK - Sql Intert statement into Access TBL

txgeekgirl

Registered User.
Local time
Today, 09:07
Joined
Jul 31, 2008
Messages
187
It actually inserts the AuditID with and without '" "' - but the Summary, without the '" "' errors something fierce. I changed the field type from Memo to text on the Tbl it is inserting into - but that didn't matter. I didn't have "AS Name" and added them. I am sure it's something stupid. :mad: OH - I also tried Me.AuditSummaryTxt instead of the forms call - that didn't help either.

Code:
 mySql = "INSERT INTO [AuditSummarization]([AuditID], [AuditSummary])" + _
            "SELECT " & sAuditID & " AS AuditID, '" & [Forms]![Update Findings]![AuditSummaryTxt] & "' AS AuditSummary ;"
        DoCmd.SetWarnings (WarningsOff)
        DoCmd.RunSQL mySql
        MsgBox "added"
        DoCmd.SetWarnings (WarningsOn)
 
Oops .. deleted my post.

Is this assuming "AuditSummary" is another table or a value in a form control?

-dK
 
I believe this should work:

Code:
mySql = "SELECT " & sAuditID & " AS AuditID, '" & [Forms]![Update Findings]![AuditSummaryTxt] & "' AS AuditSummary INTO AuditSummarization"

CurrentDb.Execute mySQL, dbFailOnError
 
And if you use CurrentDb.Execute you don't need to turn off and on the warnings.
 
Bob - you are the BEST!!!! I don't know why I have such a hard time with SQL statements in VBA - It's all I write in FoxPro. It's those stupid '" "' and where to put them. That you so much!!! :D:D:D

Hey - how did the luck run last time - did it get better?
 
Hey - how did the luck run last time - did it get better?
Not too bad :D

Thanks.jpg
 

Users who are viewing this thread

Back
Top Bottom