[AccessD] Interactive Query Question

Lonnie Johnson prodevmg at yahoo.com
Tue Aug 28 10:37:07 CDT 2007


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  


More information about the AccessD mailing list