Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 2nd, 2005, 02:54 PM
Authorized User
Join Date: Mar 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default writing SQL queries in MS access,VBA

I am able to write the update...sql statement in my VBA code but i need to write insert into...statement. Can you please give me an example.It says syntax error when I use insert into. I used the RunSql method of DoCmd object.
Brain, can you please help???

Old April 2nd, 2005, 04:46 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post

Insert into table (field1, field2, ... fieldn) Select data1, data2, ... datan

Be aware that the data values must be appropriately deleniated. A string must have quotes on either end (and not anywhere in the string). A date must have the hash (#) on either end.

Tip: Use the query builder to create an Append query (same as Insert) then switch to SQL view to get the string.

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
Old April 2nd, 2005, 07:15 PM
Authorized User
Join Date: Mar 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

Thank you soo much!
The problem was only with syntax I believe.
Thanks a lot!!!

Similar Threads
Thread Thread Starter Forum Replies Last Post
improve vba access queries using indexes jani Access 1 July 22nd, 2008 07:06 AM
list of ms access stories queries in asp red_fiesta Classic ASP Professional 6 December 18th, 2006 11:29 PM
writing to a ms access database angel79 Classic ASP Databases 2 May 25th, 2005 11:03 AM
MS Access Queries LDFProfessions Access 5 April 14th, 2005 07:35 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.