Sabtu, 28 Juni 2014

Re: [MS_AccessPros] VBA Query and loop it

 

Luigi-


This is not clear at all.  How are Table1 and Table2 related?  And the SQL in srtSQL1 is simply an incomplete SELECT query - it won't add any rows to anything.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Jun 28, 2014, at 3:01 AM, bondurri.luigi <no_reply@yahoogroups.com> wrote:

Hi all,

I would like to understand this concept, I'm trying to explain in plain code...


I have a table [TABLE1] containing 1 field FILTER_FIELD (it contain eg (1,2,3,4,5,6,7)


I would like to make a VBA query that perform the query (it write more table) depending on the filterfield in the table 1, and loop it until the filterfield values have finished:


srtSQL1= "SELECT [TABLE2].*  bla bla bla
WHERE [TABLE2].[FIELD_to_be_FILTERED])=[TABLE1].[FILTER_FIELD];"

DoCmd.RunSQL srtSQL1


later on, I transfer the created table...

DoCmd.TransferDatabase acExport, "Microsoft Access", [Path_DB], acTable, "TABLECREATED", "TABLECREATEDnewname", False


now I want to loop this procedure until value FILTER_FIELD in TABLE1 are over...


Hope it is clear; do you have a solution? Thanks in advance

Luigi



__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

.

__,_._,___

Tidak ada komentar:

Posting Komentar