![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
It's not really possible, since Access doesn't return any feedback as to where it is in the query, meaning that you would be unable to update the meter. "Phil" wrote in message news:iqccn0$42d$1 (AT) speranza (DOT) aioe.org... I am creating a table using the following SQLStg LStg = "SELECT DISTINCT Member.MemSurName, CombineFirstNames([Member]![MemAddID]) AS Name, " SQLStg = SQLStg & "LstAddress.*, ForeNames([MemSurName],[Member]![MemAddID],[MemHeadOfHouseID],30) AS [Names], " SQLStg = SQLStg & "CombineEMailAdd([Member!MemAddID]) AS EMail, Member.MemPhone, " SQLStg = SQLStg & "Member.MemMobile , " SQLStg = SQLStg & "XNames([Member]![MemHeadOfHouseID]) AS FormalNames, " SQLStg = SQLStg & "Member.MemHeadOfHouseID, " SQLStg = SQLStg & "Member.Indicator, Member.MemHead, " SQLStg LStg = SQLStg & "Emax('MemJoinDate','Member','MemAddID = ' & Member.MemAddID) AS LastToJoin, " SQLStg = SQLStg & "Ecount('MemberID','Member','MemAddID = ' & LstAddress.MemAddID) AS NoAtAddress " SQLStg = SQLStg & "INTO " & NewTable & " IN '" & OtherDBName & "'" SQLStg = SQLStg & "FROM [Year] INNER JOIN (LstAddress INNER JOIN Member " SQLStg LStg = SQLStg & "ON LstAddress.MemAddID = Member.MemAddID) ON Year.YearID = Member.YearID " SQLStg = SQLStg & "WHERE (((Member.MemHead) True) " SQLStg = SQLStg & "And ((Member.MemRetiredID) IIf([Year]![MemActivity] = 0, " SQLStg = SQLStg & "[Member].[MemRetiredID], [Year]![MemActivity]))) " SQLStg = SQLStg & "ORDER BY Member.MemSurName, CombineFirstNames([Member]![MemAddID]);" Set MyDb = CurrentDb MyDb.Execute SQLStg, dbFailOnError Fine, works OK, but it slow to run as there are a number of calculated fields. Is there any way of using a Syscmd(acSysCmdInitMeter ....), SysCmd(acSysCmdUpdateMeter, ....) and SysCmd acSysCmdRemoveMeter type sequence to show progress Thanks Phil |
#4
| |||
| |||
|
|
Fine, works OK, but it slow to run as there are a number of calculated fields. Is there any way of using a Syscmd(acSysCmdInitMeter ....), SysCmd(acSysCmdUpdateMeter, ....) and SysCmd acSysCmdRemoveMeter type sequence to show progress |
#5
| |||
| |||
|
|
Fine, works OK, but it slow to run as there are a number of calculated fields. Is there any way of using a Syscmd(acSysCmdInitMeter ....), SysCmd(acSysCmdUpdateMeter, ....) and SysCmd acSysCmdRemoveMeter type sequence to show progress Hi Phil, You could split your query in twe parts. First part to retrieve your distinct members. Second part to do the heavy job, including calculated fields, sorting, table creation etc. based on the set om members from the first query. In this second part you can use the Progress Meter. Imb. |
#6
| |||
| |||
|
|
On 11/05/2011 09:26:03, imb wrote: Fine, works OK, but it slow to run as there are a number of calculated fields. Is there any way of using a Syscmd(acSysCmdInitMeter ....), SysCmd(acSysCmdUpdateMeter, ....) and SysCmd acSysCmdRemoveMeter type sequence to show progress Hi Phil, You could split your query in twe parts. First part to retrieve your distinct members. Second part to do the heavy job, including calculated fields, sorting, table creation etc. based on the set om members from the first query. In this second part you can use the Progress Meter. Imb. Hi Imb Don't follow your suggestion. First part would gibe the no of records for the Syscmd(acSysCmdInitMeter , RecordCount) The second part is a make table run by MyDb.Execute SQLStg, dbFailOnError. The making of the table is fast, the slow bit is running the query where I am calling a number of functions to combine the individual first names of a family into a single field. So the function CombineFirstNames([Member]![MemAddID]) AS Name will turn John Smith, Mary Smith and Bill Jones, all living at the same address inti "John, Mary & Bill" Possibly I could update the meter each time I call the function? Phil- Hide quoted text - - Show quoted text - |
#7
| |||
| |||
|
|
I am creating a table using the following SQLStg LStg = "SELECT DISTINCT Member.MemSurName, CombineFirstNames([Member]![MemAddID]) AS Name, " SQLStg = SQLStg& "LstAddress.*, ForeNames([MemSurName],[Member]![MemAddID],[MemHeadOfHouseID],30) AS [Names], " SQLStg = SQLStg& "CombineEMailAdd([Member!MemAddID]) AS EMail, Member.MemPhone, " SQLStg = SQLStg& "Member.MemMobile ," SQLStg = SQLStg& "XNames([Member]![MemHeadOfHouseID]) AS FormalNames," SQLStg = SQLStg& "Member.MemHeadOfHouseID," SQLStg = SQLStg& "Member.Indicator, Member.MemHead," SQLStg LStg = SQLStg& "Emax('MemJoinDate','Member','MemAddID = '& Member.MemAddID) AS LastToJoin, " SQLStg = SQLStg& "Ecount('MemberID','Member','MemAddID = '& LstAddress.MemAddID) AS NoAtAddress " SQLStg = SQLStg& "INTO "& NewTable& " IN '"& OtherDBName& "'" SQLStg = SQLStg& "FROM [Year] INNER JOIN (LstAddress INNER JOIN Member" SQLStg LStg = SQLStg& "ON LstAddress.MemAddID = Member.MemAddID) ON Year.YearID = Member.YearID " SQLStg = SQLStg& "WHERE (((Member.MemHead) = True) " SQLStg = SQLStg& "And ((Member.MemRetiredID) = IIf([Year]![MemActivity] = 0, " SQLStg = SQLStg& "[Member].[MemRetiredID], [Year]![MemActivity]))) " SQLStg = SQLStg& "ORDER BY Member.MemSurName, CombineFirstNames([Member]![MemAddID]);" Set MyDb = CurrentDb MyDb.Execute SQLStg, dbFailOnError Fine, works OK, but it slow to run as there are a number of calculated fields. Is there any way of using a Syscmd(acSysCmdInitMeter ....), SysCmd(acSysCmdUpdateMeter, ....) and SysCmd acSysCmdRemoveMeter type sequence to show progress Thanks Phil |
#8
| |||
| |||
|
|
One thing I would do would be to drop the ORDER BY clause. Since you are using this to build a table (or populate an existing table), the order by really serves no purpose. The WHERE clause might be restructured to WHERE Member.MemHead =True And ((Member.MemRetiredID = [Member].[MemRetiredID] and [Year].MemActivity = 0) Or ([Year].Activity <> 0 and [Member.MemRetiredID] = [Year].Activity)) Of course, if you remove all the calculations (for testing purposes) and find that your original query runs very fast, then all of the above is wasted and the slowness of the query is almost all attributable to the use of all the functions. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County Hi John |
![]() |
| Thread Tools | |
| Display Modes | |
| |