SQL Basics

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesSQL Basics

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old October 14th, 2015, 03:33 PM
budatlitho budatlitho is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Oct 2015
Posts: 1 budatlitho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 48 sec
Reputation Power: 0
Add Records Using SQL in VBA

I have an Access DB with two tables, oakland_county_meetings and 20151005
I want to add only new records from 20151005 to oakland_county_meetings and have the following code:

Public Function AddRecords1() As String
Dim TableToAdd As String
Dim MainTableName As String
MainTableName = "oakland_county_meetings"
TableToAdd = "20151005" 'InputBox("Name of table?")
Dim strSQL As String
strSQL = "INSERT INTO MainTableName " & _
"SELECT TableToAdd.* " & _
"FROM TableToAdd " & _
"LEFT JOIN ON TableToAdd.nationbuilder_signup_id = MainTableName.nationbuilder_signup_id " & _
"WHERE MainTableName.nationbuilder_signup_id IS NULL;"
Debug.Print strSQL
DoCmd.RunSQL strSQL
End Function

I get "syntax error in FROM clause and am stumped.
Thanks in advance for any help.

Reply With Quote
  #2  
Old October 21st, 2015, 11:37 AM
prasanth prasanth is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2015
Posts: 3 prasanth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 35 m 50 sec
Reputation Power: 0
INSERT INTO tblCustomers (CustomerID, [Last Name], [First Name])
VALUES (1, 'Kelly', 'Jill')

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesSQL Basics > Add Records Using SQL in VBA


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap