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 May 27th, 2004, 04:10 PM
Authorized User
 
Join Date: Apr 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA to create new tbl and append 3 tbls

Hello,
I am using Access 2000 and would like to have the data in 3 tables (1,2,3)appended into a new table (tblTest) . The user would then select a criteria from a form ,using tblTest, press a button and have the result from table 1,2 or 3 in list boxes (3). Some data would be in all tables.
Thanks
 
Old May 28th, 2004, 01:49 AM
Authorized User
 
Join Date: May 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try using ADO to append the record into the new table and then refresh the list boxes.

Mihai

Ex:

Dim cnx as New ADODB.Connection
Dim str as String

Set cnx = CurrentProject.Connection
'Define str as the SQL statement that appends the record to table Temp, dependind on the conditions you want, like this

If cond1 Then
str = "INSERT INTO tblTest (Field1, Field2, ...)" & _
"SELECT Field1, Field2, ... FROM table1 ..."

cnx.Execute str
Set cnx= Nothing

'And then refresh the list boxes


 
Old May 28th, 2004, 10:43 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why not just use a union query

select * from table1
union
select * from table2
union
select * from table3;

What you really need is the result, not a table.



Sal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Change tbl permissions using VBA feets Access VBA 1 October 12th, 2007 01:19 AM
Create a .DLL callable from VBA Dan412 VB How-To 1 August 20th, 2007 10:32 AM
create table/append data. bpdineen Access VBA 1 January 4th, 2007 11:47 AM
VBA to create PDF from webpage ncarty97 Excel VBA 0 September 25th, 2006 02:48 PM
PROBLEM Inserting data into 2 tbls that r JOINED shyster1977 Classic ASP Databases 2 March 10th, 2005 10:40 AM





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