Wrox Programmer Forums
|
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 December 18th, 2003, 10:36 PM
Registered User
 
Join Date: Dec 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to solva Send a message via Yahoo to solva
Default Customer table Update

What is the simplest way to use a sql update in VBA?

"I'm Still Learning" Neely Fuller Jr.
 
Old December 21st, 2003, 02:51 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

It depends on what you want to do. You could create a module and use something like this:

Sub Main()
Dim rst1 As ADODB.Recordset
Dim sql As String
'Query
sql = "SELECT Table1.TableX From Table1"
'The important part
Set rst1 = New ADODB.Recordset
rst1.ActiveConnection = CurrentProject.Connection
rst1.CursorType = adOpenStatic
rst1.Open sql, options:=adCmdText

Do Until rst1.EOF
sql3 = "Insert into Table2 (Field1) values ('" & rst1![FieldX] & " ')
DoCmd.RunSQL sql3
Loop
End Sub

This is a simple example on how to run a query and then write those results into another table.
Hope this helps

Regards
M

Such is Life!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update one table to another table using DTS in SQL Printmaker SQL Language 0 July 24th, 2007 07:17 AM
Customer table missing? doanhvu BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 June 27th, 2006 12:57 AM
How to add indexes for my customer table? method Access VBA 3 June 24th, 2005 09:10 AM
update table with an ID Num from different table scoobie PHP How-To 12 January 25th, 2005 12:28 PM
Update parent table with the sum of child table gbrown SQL Language 2 November 9th, 2004 07:53 AM





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