Kaup, Chester
Chester_Kaup at kindermorgan.com
Tue Aug 28 11:07:55 CDT 2007
Works great. Now one more question. What combination of single and
double quotes do I use if the table name has spaces in it.
Thanks!
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Lonnie
Johnson
Sent: Tuesday, August 28, 2007 10:37 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Interactive Query Question
1. Create a new form.
2. Put a text box and a command button on it.
3. Name the text box txtTableName
4. Name the command button cmdMakeTable
5. In the Click Event of the command button put this code...
Private Sub cmdMakeTable_Click()
Dim strSQL As String
strSQL = "SELECT CUSTID, CUST_NAME, CUST_ADDRESS INTO " _
& Me.txtTableName & " FROM tblCustomers"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
End Sub
6. Of course you will change fields and tblCustomers to coincide with
your fields and table name.
7. If you want to have the warning messages then comment out the two
SetWarnings lines.
8. Load the form, type a name in the text box and click the button.,
May God bless you beyond your imagination!
Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Visit me at ==> http://www.prodev.us
----- Original Message ----
From: "Kaup, Chester" <Chester_Kaup at kindermorgan.com>
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Sent: Tuesday, August 28, 2007 9:32:40 AM
Subject: [AccessD] Interactive Query Question
I have a make table query in a database. Each time I run this I have to
go into design view and change the name of the table the query writes
to. Is there a way in the query or in VBA to insert a table name
interactively. I cannot seem to think of one. Thanks.
Chester Kaup
Engineering Technician
Kinder Morgan CO2 Company, LLP
Office (432) 688-3797
FAX (432) 688-3799
No trees were killed in the sending of this message. However a large
number of electrons were terribly inconvenienced.
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
________________________________________________________________________
____________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's
updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com