From bensonforums at gmail.com Mon Jun 1 13:29:41 2015 From: bensonforums at gmail.com (Bill Benson) Date: Mon, 1 Jun 2015 14:29:41 -0400 Subject: [AccessD] FW: Query not using criteria In-Reply-To: <8E16E03987F1FD4FB0A9BEBF7CC160CB07E368D3@HOUEX11.kindermorgan.com> References: <8E16E03987F1FD4FB0A9BEBF7CC160CB07E368D3@HOUEX11.kindermorgan.com> Message-ID: You are joining everything on PID not ChildPID, therefore if there are more than one ChildPID per those mentioned PIDs, you will of course have complementary records in which they pass the <> test. You need to also Outer Join on ChildPID where one side is NULL. On Thu, May 28, 2015 at 5:14 PM, Kaup, Chester < Chester_Kaup at kindermorgan.com> wrote: > > I have a query that does not appear to be using the criteria. Below is the > SQL for the query. Certain ChildPID's should be excluded but they are not > being excluded. What am I missing? Thanks. > > SELECT ConfigMaster.PID, Constants.SDate, ConfigMaster.ChildPID, > ConfigMaster.WellName > FROM ([tbl Injectors in All Patterns and Factor] INNER JOIN ConfigMaster > ON [tbl Injectors in All Patterns and Factor].PID = ConfigMaster.PID) INNER > JOIN Constants ON ConfigMaster.PID = Constants.PID > WHERE (((ConfigMaster.ChildPID)<>[tbl Injectors in All Patterns and > Factor]![ChildPID])) > GROUP BY ConfigMaster.PID, Constants.SDate, ConfigMaster.ChildPID, > ConfigMaster.WellName > HAVING (((ConfigMaster.PID)="PAT 109-1A")); > > This is what should be excluded > > PID ChildPID > Well_Name Sdate Factor1 Factor2 > PAT 109-1A 42415034110000 109-1 > 8/1/2006 1 1 > PAT 109-1A 42415046190000 156-1 > 8/1/2006 .25 .25 > PAT 109-1A 42415307260000 109-7 > 8/1/2006 .333333 .333333 > PAT 109-1A 42415342080000 109-1A > 8/1/2006 1 1 > > And here are the query results > > PID SDate > ChildPID WellName > PAT 109-1A 8/1/2006 42415017570000 > 111-2 > PAT 109-1A 8/1/2006 42415034110000 > 109-1 > PAT 109-1A 8/1/2006 42415034130000 > 109-3 > PAT 109-1A 8/1/2006 42415046190000 > 156-1 > PAT 109-1A 8/1/2006 42415307260000 > 109-7 > PAT 109-1A 8/1/2006 42415341260000 > 111-7 > PAT 109-1A 8/1/2006 42415341770000 > 156-1A > PAT 109-1A 8/1/2006 42415341880000 > 109-3A > PAT 109-1A 8/1/2006 42415342080000 > 109-1A > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From rockysmolin at bchacc.com Mon Jun 1 15:08:44 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Mon, 1 Jun 2015 13:08:44 -0700 Subject: [AccessD] Trying to avoid coding Message-ID: <70AC385A305A4FE8A57753885004AA93@HAL9007> Dear List: I'm exporting stuff to a spreadsheet and using a query and that's working just fine. The user wanted the last date in one of the tables so a summation query, grouping on all the fields except the date field and using MAX on the field with the dates worked out nice. Now he wants both the last date and the previous date (users (sigh) gotta love 'em) - IOW the last two dates. I can do this with code and push the values into a spreadsheet through automation, but that TransferSpreadsheet is just soooooo easy and I'm getting lazier in my old age. So is there a way to pull the last two values from a field in a table when you sort on that field with a query, getting the last value in one of the columns and the second to last in another? MTIA Rocky Smolin Beach Access Software 858-259-4334 www.bchacc.com www.e-z-mrp.com Skype: rocky.smolin From davidmcafee at gmail.com Mon Jun 1 15:19:18 2015 From: davidmcafee at gmail.com (David McAfee) Date: Mon, 1 Jun 2015 13:19:18 -0700 Subject: [AccessD] Trying to avoid coding In-Reply-To: <70AC385A305A4FE8A57753885004AA93@HAL9007> References: <70AC385A305A4FE8A57753885004AA93@HAL9007> Message-ID: DMAX? On Mon, Jun 1, 2015 at 1:08 PM, Rocky Smolin wrote: > Dear List: > > I'm exporting stuff to a spreadsheet and using a query and that's working > just fine. The user wanted the last date in one of the tables so a > summation query, grouping on all the fields except the date field and using > MAX on the field with the dates worked out nice. > > Now he wants both the last date and the previous date (users (sigh) gotta > love 'em) - IOW the last two dates. I can do this with code and push the > values into a spreadsheet through automation, but that TransferSpreadsheet > is just soooooo easy and I'm getting lazier in my old age. > > So is there a way to pull the last two values from a field in a table when > you sort on that field with a query, getting the last value in one of the > columns and the second to last in another? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com > www.e-z-mrp.com > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From davidmcafee at gmail.com Mon Jun 1 15:28:31 2015 From: davidmcafee at gmail.com (David McAfee) Date: Mon, 1 Jun 2015 13:28:31 -0700 Subject: [AccessD] Trying to avoid coding In-Reply-To: <70AC385A305A4FE8A57753885004AA93@HAL9007> References: <70AC385A305A4FE8A57753885004AA93@HAL9007> Message-ID: Replace SomeDate with your Date, SomeTable with your table (or query) and 1=1 with your cirteria MaxDate: Expr1: DMax("SomeDate","tblSomeTable","1=1") 2nd highest Date: Expr2: DMax("SomeDate","tblSomeTable","[SomeDate] wrote: > Dear List: > > I'm exporting stuff to a spreadsheet and using a query and that's working > just fine. The user wanted the last date in one of the tables so a > summation query, grouping on all the fields except the date field and using > MAX on the field with the dates worked out nice. > > Now he wants both the last date and the previous date (users (sigh) gotta > love 'em) - IOW the last two dates. I can do this with code and push the > values into a spreadsheet through automation, but that TransferSpreadsheet > is just soooooo easy and I'm getting lazier in my old age. > > So is there a way to pull the last two values from a field in a table when > you sort on that field with a query, getting the last value in one of the > columns and the second to last in another? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com > www.e-z-mrp.com > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From steve at datamanagementsolutions.biz Mon Jun 1 16:05:12 2015 From: steve at datamanagementsolutions.biz (Steve Schapel) Date: Tue, 2 Jun 2015 09:05:12 +1200 Subject: [AccessD] Trying to avoid coding In-Reply-To: <70AC385A305A4FE8A57753885004AA93@HAL9007> References: <70AC385A305A4FE8A57753885004AA93@HAL9007> Message-ID: <6536624812FB47518284F73605F6E2B9@SteveT540p> Hi Rocky Is this suitable?... Make an interim query like this: SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY YourDateField DESC Then add that query to your export query, and add these columns: Max([YourInterimQuery].[YourDateField]) Min([YourInterimQuery].[YourDateField]) This should give you the last date and the second last date from the table. Regards Steve -----Original Message----- From: Rocky Smolin Sent: Tuesday, June 2, 2015 8:08 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Trying to avoid coding Dear List: I'm exporting stuff to a spreadsheet and using a query and that's working just fine. The user wanted the last date in one of the tables so a summation query, grouping on all the fields except the date field and using MAX on the field with the dates worked out nice. Now he wants both the last date and the previous date (users (sigh) gotta love 'em) - IOW the last two dates. I can do this with code and push the values into a spreadsheet through automation, but that TransferSpreadsheet is just soooooo easy and I'm getting lazier in my old age. So is there a way to pull the last two values from a field in a table when you sort on that field with a query, getting the last value in one of the columns and the second to last in another? MTIA Rocky Smolin Beach Access Software 858-259-4334 www.bchacc.com www.e-z-mrp.com Skype: rocky.smolin -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From stuart at lexacorp.com.pg Mon Jun 1 16:22:03 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Tue, 02 Jun 2015 07:22:03 +1000 Subject: [AccessD] Trying to avoid coding In-Reply-To: <6536624812FB47518284F73605F6E2B9@SteveT540p> References: <70AC385A305A4FE8A57753885004AA93@HAL9007>, <6536624812FB47518284F73605F6E2B9@SteveT540p> Message-ID: <556CCCFB.8972.30D239F4@stuart.lexacorp.com.pg> I second the TOP TWO subquery appraoch. On 2 Jun 2015 at 9:05, Steve Schapel wrote: > Hi Rocky > > Is this suitable?... > > Make an interim query like this: > > SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY > YourDateField DESC > > Then add that query to your export query, and add these columns: > > Max([YourInterimQuery].[YourDateField]) > Min([YourInterimQuery].[YourDateField]) > > This should give you the last date and the second last date from the > table. > > Regards > Steve > > > -----Original Message----- > From: Rocky Smolin > Sent: Tuesday, June 2, 2015 8:08 AM > To: 'Access Developers discussion and problem solving' > Subject: [AccessD] Trying to avoid coding > > Dear List: > > I'm exporting stuff to a spreadsheet and using a query and that's > working just fine. The user wanted the last date in one of the tables > so a summation query, grouping on all the fields except the date field > and using MAX on the field with the dates worked out nice. > > Now he wants both the last date and the previous date (users (sigh) > gotta love 'em) - IOW the last two dates. I can do this with code and > push the values into a spreadsheet through automation, but that > TransferSpreadsheet is just soooooo easy and I'm getting lazier in my > old age. > > So is there a way to pull the last two values from a field in a table > when you sort on that field with a query, getting the last value in > one of the columns and the second to last in another? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com > www.e-z-mrp.com > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From rockysmolin at bchacc.com Mon Jun 1 16:22:25 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Mon, 1 Jun 2015 14:22:25 -0700 Subject: [AccessD] Trying to avoid coding In-Reply-To: References: <70AC385A305A4FE8A57753885004AA93@HAL9007> Message-ID: <5DD1F6F17236490E8B518EB911B640F2@HAL9007> DAMX will get the last one. I need the second to last one. R -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee Sent: Monday, June 01, 2015 1:19 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Trying to avoid coding DMAX? On Mon, Jun 1, 2015 at 1:08 PM, Rocky Smolin wrote: > Dear List: > > I'm exporting stuff to a spreadsheet and using a query and that's > working just fine. The user wanted the last date in one of the tables > so a summation query, grouping on all the fields except the date field > and using MAX on the field with the dates worked out nice. > > Now he wants both the last date and the previous date (users (sigh) > gotta love 'em) - IOW the last two dates. I can do this with code and > push the values into a spreadsheet through automation, but that > TransferSpreadsheet is just soooooo easy and I'm getting lazier in my old age. > > So is there a way to pull the last two values from a field in a table > when you sort on that field with a query, getting the last value in > one of the columns and the second to last in another? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com www.e-z-mrp.com > > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From rockysmolin at bchacc.com Mon Jun 1 16:23:07 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Mon, 1 Jun 2015 14:23:07 -0700 Subject: [AccessD] Trying to avoid coding In-Reply-To: References: <70AC385A305A4FE8A57753885004AA93@HAL9007> Message-ID: <789BD319F17B4ADE944210CF606B75EB@HAL9007> Excellent. I'll try it! Thx Rocky -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee Sent: Monday, June 01, 2015 1:29 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Trying to avoid coding Replace SomeDate with your Date, SomeTable with your table (or query) and 1=1 with your cirteria MaxDate: Expr1: DMax("SomeDate","tblSomeTable","1=1") 2nd highest Date: Expr2: DMax("SomeDate","tblSomeTable","[SomeDate] wrote: > Dear List: > > I'm exporting stuff to a spreadsheet and using a query and that's > working just fine. The user wanted the last date in one of the tables > so a summation query, grouping on all the fields except the date field > and using MAX on the field with the dates worked out nice. > > Now he wants both the last date and the previous date (users (sigh) > gotta love 'em) - IOW the last two dates. I can do this with code and > push the values into a spreadsheet through automation, but that > TransferSpreadsheet is just soooooo easy and I'm getting lazier in my old age. > > So is there a way to pull the last two values from a field in a table > when you sort on that field with a query, getting the last value in > one of the columns and the second to last in another? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com www.e-z-mrp.com > > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From rockysmolin at bchacc.com Mon Jun 1 16:24:04 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Mon, 1 Jun 2015 14:24:04 -0700 Subject: [AccessD] Trying to avoid coding In-Reply-To: <6536624812FB47518284F73605F6E2B9@SteveT540p> References: <70AC385A305A4FE8A57753885004AA93@HAL9007> <6536624812FB47518284F73605F6E2B9@SteveT540p> Message-ID: That's a good approach. Thank you. I'll give it a try. rocky -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel Sent: Monday, June 01, 2015 2:05 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Trying to avoid coding Hi Rocky Is this suitable?... Make an interim query like this: SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY YourDateField DESC Then add that query to your export query, and add these columns: Max([YourInterimQuery].[YourDateField]) Min([YourInterimQuery].[YourDateField]) This should give you the last date and the second last date from the table. Regards Steve -----Original Message----- From: Rocky Smolin Sent: Tuesday, June 2, 2015 8:08 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Trying to avoid coding Dear List: I'm exporting stuff to a spreadsheet and using a query and that's working just fine. The user wanted the last date in one of the tables so a summation query, grouping on all the fields except the date field and using MAX on the field with the dates worked out nice. Now he wants both the last date and the previous date (users (sigh) gotta love 'em) - IOW the last two dates. I can do this with code and push the values into a spreadsheet through automation, but that TransferSpreadsheet is just soooooo easy and I'm getting lazier in my old age. So is there a way to pull the last two values from a field in a table when you sort on that field with a query, getting the last value in one of the columns and the second to last in another? MTIA Rocky Smolin Beach Access Software 858-259-4334 www.bchacc.com www.e-z-mrp.com Skype: rocky.smolin -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Mon Jun 1 16:38:53 2015 From: bensonforums at gmail.com (Bill Benson) Date: Mon, 1 Jun 2015 17:38:53 -0400 Subject: [AccessD] Trying to avoid coding In-Reply-To: <6536624812FB47518284F73605F6E2B9@SteveT540p> References: <70AC385A305A4FE8A57753885004AA93@HAL9007> <6536624812FB47518284F73605F6E2B9@SteveT540p> Message-ID: Maybe a little more concise, if you are not averse to IN operator: do your normal query and add in the where clause Where DateField in (Select distinct TOP 2 DateField From YourTable order by YourTable.DateField) On Jun 1, 2015 5:07 PM, "Steve Schapel" wrote: > Hi Rocky > > Is this suitable?... > > Make an interim query like this: > > SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY YourDateField > DESC > > Then add that query to your export query, and add these columns: > > Max([YourInterimQuery].[YourDateField]) > Min([YourInterimQuery].[YourDateField]) > > This should give you the last date and the second last date from the table. > > Regards > Steve > > > -----Original Message----- From: Rocky Smolin > Sent: Tuesday, June 2, 2015 8:08 AM > To: 'Access Developers discussion and problem solving' > Subject: [AccessD] Trying to avoid coding > > Dear List: > > I'm exporting stuff to a spreadsheet and using a query and that's working > just fine. The user wanted the last date in one of the tables so a > summation query, grouping on all the fields except the date field and using > MAX on the field with the dates worked out nice. > > Now he wants both the last date and the previous date (users (sigh) gotta > love 'em) - IOW the last two dates. I can do this with code and push the > values into a spreadsheet through automation, but that TransferSpreadsheet > is just soooooo easy and I'm getting lazier in my old age. > > So is there a way to pull the last two values from a field in a table when > you sort on that field with a query, getting the last value in one of the > columns and the second to last in another? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com > www.e-z-mrp.com > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From steve at datamanagementsolutions.biz Mon Jun 1 17:03:46 2015 From: steve at datamanagementsolutions.biz (Steve Schapel) Date: Tue, 2 Jun 2015 10:03:46 +1200 Subject: [AccessD] Trying to avoid coding In-Reply-To: References: <70AC385A305A4FE8A57753885004AA93@HAL9007><6536624812FB47518284F73605F6E2B9@SteveT540p> Message-ID: <382BE3FFA2914F05B3A379751DC14EF8@SteveT540p> Hi Bill I had understood that Rocky still wanted the exported data to include records in addition to those with the most recent dates. Regards Steve -----Original Message----- From: Bill Benson Sent: Tuesday, June 2, 2015 9:38 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Trying to avoid coding Maybe a little more concise, if you are not averse to IN operator: do your normal query and add in the where clause Where DateField in (Select distinct TOP 2 DateField From YourTable order by YourTable.DateField) On Jun 1, 2015 5:07 PM, "Steve Schapel" wrote: > Hi Rocky > > Is this suitable?... > > Make an interim query like this: > > SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY YourDateField > DESC > > Then add that query to your export query, and add these columns: > > Max([YourInterimQuery].[YourDateField]) > Min([YourInterimQuery].[YourDateField]) > > This should give you the last date and the second last date from the > table. > > Regards > Steve > > > -----Original Message----- From: Rocky Smolin > Sent: Tuesday, June 2, 2015 8:08 AM > To: 'Access Developers discussion and problem solving' > Subject: [AccessD] Trying to avoid coding > > Dear List: > > I'm exporting stuff to a spreadsheet and using a query and that's working > just fine. The user wanted the last date in one of the tables so a > summation query, grouping on all the fields except the date field and > using > MAX on the field with the dates worked out nice. > > Now he wants both the last date and the previous date (users (sigh) gotta > love 'em) - IOW the last two dates. I can do this with code and push the > values into a spreadsheet through automation, but that TransferSpreadsheet > is just soooooo easy and I'm getting lazier in my old age. > > So is there a way to pull the last two values from a field in a table when > you sort on that field with a query, getting the last value in one of the > columns and the second to last in another? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 From rockysmolin at bchacc.com Mon Jun 1 17:08:17 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Mon, 1 Jun 2015 15:08:17 -0700 Subject: [AccessD] Trying to avoid coding In-Reply-To: <382BE3FFA2914F05B3A379751DC14EF8@SteveT540p> References: <70AC385A305A4FE8A57753885004AA93@HAL9007><6536624812FB47518284F73605F6E2B9@SteveT540p> <382BE3FFA2914F05B3A379751DC14EF8@SteveT540p> Message-ID: <1CCAF7F6F1F8467C8A7C66DB1F8D4BD3@HAL9007> Yeah the record will need a column of last date and second to last date. I think the query that pulls the last two dates will work, joined to the original query and then use Max and Min to get the last and second to last dates. R -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel Sent: Monday, June 01, 2015 3:04 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Trying to avoid coding Hi Bill I had understood that Rocky still wanted the exported data to include records in addition to those with the most recent dates. Regards Steve -----Original Message----- From: Bill Benson Sent: Tuesday, June 2, 2015 9:38 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Trying to avoid coding Maybe a little more concise, if you are not averse to IN operator: do your normal query and add in the where clause Where DateField in (Select distinct TOP 2 DateField From YourTable order by YourTable.DateField) On Jun 1, 2015 5:07 PM, "Steve Schapel" wrote: > Hi Rocky > > Is this suitable?... > > Make an interim query like this: > > SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY > YourDateField DESC > > Then add that query to your export query, and add these columns: > > Max([YourInterimQuery].[YourDateField]) > Min([YourInterimQuery].[YourDateField]) > > This should give you the last date and the second last date from the > table. > > Regards > Steve > > > -----Original Message----- From: Rocky Smolin > Sent: Tuesday, June 2, 2015 8:08 AM > To: 'Access Developers discussion and problem solving' > Subject: [AccessD] Trying to avoid coding > > Dear List: > > I'm exporting stuff to a spreadsheet and using a query and that's > working just fine. The user wanted the last date in one of the tables > so a summation query, grouping on all the fields except the date field > and using MAX on the field with the dates worked out nice. > > Now he wants both the last date and the previous date (users (sigh) > gotta love 'em) - IOW the last two dates. I can do this with code and > push the values into a spreadsheet through automation, but that > TransferSpreadsheet is just soooooo easy and I'm getting lazier in my old age. > > So is there a way to pull the last two values from a field in a table > when you sort on that field with a query, getting the last value in > one of the columns and the second to last in another? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Mon Jun 1 17:08:54 2015 From: bensonforums at gmail.com (Bill Benson) Date: Mon, 1 Jun 2015 18:08:54 -0400 Subject: [AccessD] Trying to avoid coding In-Reply-To: <382BE3FFA2914F05B3A379751DC14EF8@SteveT540p> References: <70AC385A305A4FE8A57753885004AA93@HAL9007> <6536624812FB47518284F73605F6E2B9@SteveT540p> <382BE3FFA2914F05B3A379751DC14EF8@SteveT540p> Message-ID: Ah .... I get it now (I think) - so these are to be additional columns in the Select clause? My bad, thanks for setting me straight (with remarkable courtesy!) On Jun 1, 2015 6:04 PM, "Steve Schapel" wrote: > Hi Bill > > I had understood that Rocky still wanted the exported data to include > records in addition to those with the most recent dates. > > Regards > Steve > > -----Original Message----- From: Bill Benson > Sent: Tuesday, June 2, 2015 9:38 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Trying to avoid coding > > Maybe a little more concise, if you are not averse to IN operator: > > do your normal query and add in the where clause > > Where DateField in (Select distinct TOP 2 DateField From YourTable order by > YourTable.DateField) > On Jun 1, 2015 5:07 PM, "Steve Schapel" > > wrote: > > Hi Rocky >> >> Is this suitable?... >> >> Make an interim query like this: >> >> SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY YourDateField >> DESC >> >> Then add that query to your export query, and add these columns: >> >> Max([YourInterimQuery].[YourDateField]) >> Min([YourInterimQuery].[YourDateField]) >> >> This should give you the last date and the second last date from the >> table. >> >> Regards >> Steve >> >> >> -----Original Message----- From: Rocky Smolin >> Sent: Tuesday, June 2, 2015 8:08 AM >> To: 'Access Developers discussion and problem solving' >> Subject: [AccessD] Trying to avoid coding >> >> Dear List: >> >> I'm exporting stuff to a spreadsheet and using a query and that's working >> just fine. The user wanted the last date in one of the tables so a >> summation query, grouping on all the fields except the date field and >> using >> MAX on the field with the dates worked out nice. >> >> Now he wants both the last date and the previous date (users (sigh) gotta >> love 'em) - IOW the last two dates. I can do this with code and push the >> values into a spreadsheet through automation, but that TransferSpreadsheet >> is just soooooo easy and I'm getting lazier in my old age. >> >> So is there a way to pull the last two values from a field in a table when >> you sort on that field with a query, getting the last value in one of the >> columns and the second to last in another? >> >> MTIA >> >> Rocky Smolin >> Beach Access Software >> 858-259-4334 >> > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Mon Jun 1 17:32:03 2015 From: bensonforums at gmail.com (Bill Benson) Date: Mon, 1 Jun 2015 18:32:03 -0400 Subject: [AccessD] Trying to avoid coding In-Reply-To: <1CCAF7F6F1F8467C8A7C66DB1F8D4BD3@HAL9007> References: <70AC385A305A4FE8A57753885004AA93@HAL9007> <6536624812FB47518284F73605F6E2B9@SteveT540p> <382BE3FFA2914F05B3A379751DC14EF8@SteveT540p> <1CCAF7F6F1F8467C8A7C66DB1F8D4BD3@HAL9007> Message-ID: Why joined? I got this to work without a Join: SELECT Table2.Field2, Table2.Field3, (Select Min(Field3) From (Select Distinct Top 2 Field3 From Table2 Order By Field3 Desc) ) AS 2ndHighestDate, (Select Max(Field3) From (Select Distinct Top 2 Field3 From Table2 Order By Field3 Desc) ) AS HighestDate FROM Table2; On Jun 1, 2015 6:09 PM, "Rocky Smolin" wrote: > Yeah the record will need a column of last date and second to last date. I > think the query that pulls the last two dates will work, joined to the > original query and then use Max and Min to get the last and second to last > dates. > > R > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Steve Schapel > Sent: Monday, June 01, 2015 3:04 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Trying to avoid coding > > Hi Bill > > I had understood that Rocky still wanted the exported data to include > records in addition to those with the most recent dates. > > Regards > Steve > > -----Original Message----- > From: Bill Benson > Sent: Tuesday, June 2, 2015 9:38 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Trying to avoid coding > > Maybe a little more concise, if you are not averse to IN operator: > > do your normal query and add in the where clause > > Where DateField in (Select distinct TOP 2 DateField From YourTable order by > YourTable.DateField) > On Jun 1, 2015 5:07 PM, "Steve Schapel" > > wrote: > > > Hi Rocky > > > > Is this suitable?... > > > > Make an interim query like this: > > > > SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY > > YourDateField DESC > > > > Then add that query to your export query, and add these columns: > > > > Max([YourInterimQuery].[YourDateField]) > > Min([YourInterimQuery].[YourDateField]) > > > > This should give you the last date and the second last date from the > > table. > > > > Regards > > Steve > > > > > > -----Original Message----- From: Rocky Smolin > > Sent: Tuesday, June 2, 2015 8:08 AM > > To: 'Access Developers discussion and problem solving' > > Subject: [AccessD] Trying to avoid coding > > > > Dear List: > > > > I'm exporting stuff to a spreadsheet and using a query and that's > > working just fine. The user wanted the last date in one of the tables > > so a summation query, grouping on all the fields except the date field > > and using MAX on the field with the dates worked out nice. > > > > Now he wants both the last date and the previous date (users (sigh) > > gotta love 'em) - IOW the last two dates. I can do this with code and > > push the values into a spreadsheet through automation, but that > > TransferSpreadsheet is just soooooo easy and I'm getting lazier in my old > age. > > > > So is there a way to pull the last two values from a field in a table > > when you sort on that field with a query, getting the last value in > > one of the columns and the second to last in another? > > > > MTIA > > > > Rocky Smolin > > Beach Access Software > > 858-259-4334 > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From rockysmolin at bchacc.com Mon Jun 1 18:37:55 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Mon, 1 Jun 2015 16:37:55 -0700 Subject: [AccessD] Trying to avoid coding In-Reply-To: References: <70AC385A305A4FE8A57753885004AA93@HAL9007><6536624812FB47518284F73605F6E2B9@SteveT540p><382BE3FFA2914F05B3A379751DC14EF8@SteveT540p><1CCAF7F6F1F8467C8A7C66DB1F8D4BD3@HAL9007> Message-ID: Definitely will work. I find it easier to break those things up into two or more queries. Easier for me to maintain (old guy, you know). r -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Monday, June 01, 2015 3:32 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Trying to avoid coding Why joined? I got this to work without a Join: SELECT Table2.Field2, Table2.Field3, (Select Min(Field3) From (Select Distinct Top 2 Field3 From Table2 Order By Field3 Desc) ) AS 2ndHighestDate, (Select Max(Field3) From (Select Distinct Top 2 Field3 From Table2 Order By Field3 Desc) ) AS HighestDate FROM Table2; On Jun 1, 2015 6:09 PM, "Rocky Smolin" wrote: > Yeah the record will need a column of last date and second to last > date. I think the query that pulls the last two dates will work, > joined to the original query and then use Max and Min to get the last > and second to last dates. > > R > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of Steve Schapel > Sent: Monday, June 01, 2015 3:04 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Trying to avoid coding > > Hi Bill > > I had understood that Rocky still wanted the exported data to include > records in addition to those with the most recent dates. > > Regards > Steve > > -----Original Message----- > From: Bill Benson > Sent: Tuesday, June 2, 2015 9:38 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Trying to avoid coding > > Maybe a little more concise, if you are not averse to IN operator: > > do your normal query and add in the where clause > > Where DateField in (Select distinct TOP 2 DateField From YourTable > order by > YourTable.DateField) > On Jun 1, 2015 5:07 PM, "Steve Schapel" > > > wrote: > > > Hi Rocky > > > > Is this suitable?... > > > > Make an interim query like this: > > > > SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY > > YourDateField DESC > > > > Then add that query to your export query, and add these columns: > > > > Max([YourInterimQuery].[YourDateField]) > > Min([YourInterimQuery].[YourDateField]) > > > > This should give you the last date and the second last date from the > > table. > > > > Regards > > Steve > > > > > > -----Original Message----- From: Rocky Smolin > > Sent: Tuesday, June 2, 2015 8:08 AM > > To: 'Access Developers discussion and problem solving' > > Subject: [AccessD] Trying to avoid coding > > > > Dear List: > > > > I'm exporting stuff to a spreadsheet and using a query and that's > > working just fine. The user wanted the last date in one of the > > tables so a summation query, grouping on all the fields except the > > date field and using MAX on the field with the dates worked out nice. > > > > Now he wants both the last date and the previous date (users (sigh) > > gotta love 'em) - IOW the last two dates. I can do this with code > > and push the values into a spreadsheet through automation, but that > > TransferSpreadsheet is just soooooo easy and I'm getting lazier in > > my old > age. > > > > So is there a way to pull the last two values from a field in a > > table when you sort on that field with a query, getting the last > > value in one of the columns and the second to last in another? > > > > MTIA > > > > Rocky Smolin > > Beach Access Software > > 858-259-4334 > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From rockysmolin at bchacc.com Tue Jun 2 08:49:55 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Tue, 2 Jun 2015 06:49:55 -0700 Subject: [AccessD] Trying to avoid coding In-Reply-To: <6536624812FB47518284F73605F6E2B9@SteveT540p> References: <70AC385A305A4FE8A57753885004AA93@HAL9007> <6536624812FB47518284F73605F6E2B9@SteveT540p> Message-ID: <8F879C279FAD4960A9128128DF12E282@HAL9007> Steve: OK - ran into a little problem. To be more specific, the table has four fields - 1) fldBNYMeetingIDAutonumber ID (can be ignored), 2) fldBNYID (FK to the tblBNY where BNY is a table of clients), 3) fldBNYMeetingDate 4) fldBNYMeetingTypeID (FK to a table of meeting types. So what I need is the last two meeting records for each fldBNYID. The query needs all three fields 2, 3, and 4, in order to get the two dates needed by Client to push out to the spreadsheet. Any ideas? TIA Rocky -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel Sent: Monday, June 01, 2015 2:05 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Trying to avoid coding Hi Rocky Is this suitable?... Make an interim query like this: SELECT DISTINCT TOP 2 YourDateField FROM YourTable ORDER BY YourDateField DESC Then add that query to your export query, and add these columns: Max([YourInterimQuery].[YourDateField]) Min([YourInterimQuery].[YourDateField]) This should give you the last date and the second last date from the table. Regards Steve -----Original Message----- From: Rocky Smolin Sent: Tuesday, June 2, 2015 8:08 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Trying to avoid coding Dear List: I'm exporting stuff to a spreadsheet and using a query and that's working just fine. The user wanted the last date in one of the tables so a summation query, grouping on all the fields except the date field and using MAX on the field with the dates worked out nice. Now he wants both the last date and the previous date (users (sigh) gotta love 'em) - IOW the last two dates. I can do this with code and push the values into a spreadsheet through automation, but that TransferSpreadsheet is just soooooo easy and I'm getting lazier in my old age. So is there a way to pull the last two values from a field in a table when you sort on that field with a query, getting the last value in one of the columns and the second to last in another? MTIA Rocky Smolin Beach Access Software 858-259-4334 www.bchacc.com www.e-z-mrp.com Skype: rocky.smolin -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From tinanfields at torchlake.com Tue Jun 2 10:51:26 2015 From: tinanfields at torchlake.com (Tina Norris Fields) Date: Tue, 02 Jun 2015 11:51:26 -0400 Subject: [AccessD] Can I do this? Message-ID: <556DD0FE.4070509@torchlake.com> I'm making a database for a local law firm. They have in place a paper system that is complex, but, it works. They are sort of ready to switch to an electronic system, but, it has to look just like the paper system already in place. Once they know they can trust an electronic system, they'll allow remodeling to simplify. That's the situation. I'm working on a particular part of the system now, and could use some help. A new file number is created from a six-digit sequential number, a dash, a two-digit number for the month, a dash, and a two-digit number for the year, resulting in numbers (short text) such as this: 011456-05-15. I've made a form that has unbound controls for crafting the number. A textbox txtMaxSeqNo displays the value DMax("File_SeqNo","tblFiles") as a starting point. A button btnMakeNext runs the Event Procedure: Private Sub btnMakeNext_Click() TF_number.Value = Format(Int(txtMaxFileSeqNo) + 1, "000000") TF_month.Value = Left(CStr(Date), 2) TF_year.Value = Right(CStr(Date), 2) TF_Date.Value = Date End Sub I want to add these values as a new record to the existing tblFiles. Can I make a temp table from these values, append them to the real table, and delete the temp table? Can I craft a query from these unbound control values and use it to make a temp table, or to append directly to the real table? I'm not seeing how to capture the values from this form and put them eventually into the the real table. Ultimately, of course, all this will be behind the scenes, attached to a click event, but, while I'm building it, I want to see each step succeed before moving on. I'll appreciate ideas. TNF -- Tina Norris Fields tinanfields-at-torchlake-dot-com 231-322-2787 From tinanfields at torchlake.com Tue Jun 2 11:41:32 2015 From: tinanfields at torchlake.com (Tina Norris Fields) Date: Tue, 02 Jun 2015 12:41:32 -0400 Subject: [AccessD] Can I do this? In-Reply-To: <556DD0FE.4070509@torchlake.com> References: <556DD0FE.4070509@torchlake.com> Message-ID: <556DDCBC.8010909@torchlake.com> As a follow up - if I use temporary variables, this looks feasible. TNF Tina Norris Fields tinanfields-at-torchlake-dot-com 231-322-2787 On 06/02/15 11:51 AM, Tina Norris Fields wrote: > I'm making a database for a local law firm. They have in place a > paper system that is complex, but, it works. They are sort of ready > to switch to an electronic system, but, it has to look just like the > paper system already in place. Once they know they can trust an > electronic system, they'll allow remodeling to simplify. That's the > situation. I'm working on a particular part of the system now, and > could use some help. > > A new file number is created from a six-digit sequential number, a > dash, a two-digit number for the month, a dash, and a two-digit number > for the year, resulting in numbers (short text) such as this: > 011456-05-15. > > I've made a form that has unbound controls for crafting the number. > A textbox txtMaxSeqNo displays the value DMax("File_SeqNo","tblFiles") > as a starting point. > A button btnMakeNext runs the Event Procedure: > Private Sub btnMakeNext_Click() > TF_number.Value = Format(Int(txtMaxFileSeqNo) + 1, "000000") > TF_month.Value = Left(CStr(Date), 2) > TF_year.Value = Right(CStr(Date), 2) > TF_Date.Value = Date > End Sub > > I want to add these values as a new record to the existing tblFiles. > Can I make a temp table from these values, append them to the real > table, and delete the temp table? Can I craft a query from these > unbound control values and use it to make a temp table, or to append > directly to the real table? I'm not seeing how to capture the values > from this form and put them eventually into the the real table. > > Ultimately, of course, all this will be behind the scenes, attached to > a click event, but, while I'm building it, I want to see each step > succeed before moving on. > > I'll appreciate ideas. > > TNF > From davidmcafee at gmail.com Tue Jun 2 11:53:31 2015 From: davidmcafee at gmail.com (David McAfee) Date: Tue, 2 Jun 2015 09:53:31 -0700 Subject: [AccessD] Trying to avoid coding In-Reply-To: <8F879C279FAD4960A9128128DF12E282@HAL9007> References: <70AC385A305A4FE8A57753885004AA93@HAL9007> <6536624812FB47518284F73605F6E2B9@SteveT540p> <8F879C279FAD4960A9128128DF12E282@HAL9007> Message-ID: I'd save this as a query (just to keep Access from making it's normal subquery ugliness): SELECT fldBNYMeetingID, Max([YourInterimQuery].[YourDateField]) AS LastMeetingDate, Min([YourInterimQuery].[YourDateField]) as NextToLastMeetingDate FROM (SELECT DISTINCT TOP 2 fldBNYMeetingID, fldBNYMeetingDate FROM YourTable ORDER BY fldBNYMeetingDate DESC) AS A Now join your table to the query on fldBNYMeetingID On Tue, Jun 2, 2015 at 6:49 AM, Rocky Smolin wrote: > Steve: > > OK - ran into a little problem. To be more specific, the table has four > fields - > > 1) fldBNYMeetingIDAutonumber ID (can be ignored), > 2) fldBNYID (FK to the tblBNY where BNY is a table of clients), > 3) fldBNYMeetingDate > 4) fldBNYMeetingTypeID (FK to a table of meeting types. > > So what I need is the last two meeting records for each fldBNYID. The query > needs all three fields 2, 3, and 4, in order to get the two dates needed by > Client to push out to the spreadsheet. > > > > Any ideas? > > TIA > > Rocky > > From Chester_Kaup at kindermorgan.com Tue Jun 2 15:04:14 2015 From: Chester_Kaup at kindermorgan.com (Kaup, Chester) Date: Tue, 2 Jun 2015 20:04:14 +0000 Subject: [AccessD] FW: Query not using criteria In-Reply-To: References: <8E16E03987F1FD4FB0A9BEBF7CC160CB07E368D3@HOUEX11.kindermorgan.com> Message-ID: <8E16E03987F1FD4FB0A9BEBF7CC160CB07E4059F@HOUEX11.kindermorgan.com> Thank You. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Monday, June 01, 2015 1:30 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] FW: Query not using criteria You are joining everything on PID not ChildPID, therefore if there are more than one ChildPID per those mentioned PIDs, you will of course have complementary records in which they pass the <> test. You need to also Outer Join on ChildPID where one side is NULL. On Thu, May 28, 2015 at 5:14 PM, Kaup, Chester < Chester_Kaup at kindermorgan.com> wrote: > > I have a query that does not appear to be using the criteria. Below is > the SQL for the query. Certain ChildPID's should be excluded but they > are not being excluded. What am I missing? Thanks. > > SELECT ConfigMaster.PID, Constants.SDate, ConfigMaster.ChildPID, > ConfigMaster.WellName FROM ([tbl Injectors in All Patterns and Factor] > INNER JOIN ConfigMaster ON [tbl Injectors in All Patterns and > Factor].PID = ConfigMaster.PID) INNER JOIN Constants ON > ConfigMaster.PID = Constants.PID WHERE (((ConfigMaster.ChildPID)<>[tbl > Injectors in All Patterns and > Factor]![ChildPID])) > GROUP BY ConfigMaster.PID, Constants.SDate, ConfigMaster.ChildPID, > ConfigMaster.WellName HAVING (((ConfigMaster.PID)="PAT 109-1A")); > > This is what should be excluded > > PID ChildPID > Well_Name Sdate Factor1 Factor2 > PAT 109-1A 42415034110000 109-1 > 8/1/2006 1 1 > PAT 109-1A 42415046190000 156-1 > 8/1/2006 .25 .25 > PAT 109-1A 42415307260000 109-7 > 8/1/2006 .333333 .333333 > PAT 109-1A 42415342080000 109-1A > 8/1/2006 1 1 > > And here are the query results > > PID SDate > ChildPID WellName > PAT 109-1A 8/1/2006 42415017570000 > 111-2 > PAT 109-1A 8/1/2006 42415034110000 > 109-1 > PAT 109-1A 8/1/2006 42415034130000 > 109-3 > PAT 109-1A 8/1/2006 42415046190000 > 156-1 > PAT 109-1A 8/1/2006 42415307260000 > 109-7 > PAT 109-1A 8/1/2006 42415341260000 > 111-7 > PAT 109-1A 8/1/2006 42415341770000 > 156-1A > PAT 109-1A 8/1/2006 42415341880000 > 109-3A > PAT 109-1A 8/1/2006 42415342080000 > 109-1A > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From jimdettman at verizon.net Tue Jun 2 16:37:50 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Tue, 02 Jun 2015 17:37:50 -0400 Subject: [AccessD] Can I do this? In-Reply-To: <556DD0FE.4070509@torchlake.com> References: <556DD0FE.4070509@torchlake.com> Message-ID: <6D6A4251EE0748049E5CBD3ACC1A4BF0@XPS> Not sure I'm following the question... But first comment, if this is a multi-user situation, then using Dmax() is unreliable. I would have a procedure to generate the sequential number based on a value stored in a table. No need for all the unbound fields, as you can simply do: =GenerateKey("tblFiles") & "-" & Month(Date()) & "-" Day(Date()) You now have your key. With that, you can simply save it into the main table with either a SQL Insert or use a record set addnew. I have code for the GenerateKey() routine if you want it. Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Tina Norris Fields Sent: Tuesday, June 02, 2015 11:51 AM To: DatabaseAdvisors-Access Subject: [AccessD] Can I do this? I'm making a database for a local law firm. They have in place a paper system that is complex, but, it works. They are sort of ready to switch to an electronic system, but, it has to look just like the paper system already in place. Once they know they can trust an electronic system, they'll allow remodeling to simplify. That's the situation. I'm working on a particular part of the system now, and could use some help. A new file number is created from a six-digit sequential number, a dash, a two-digit number for the month, a dash, and a two-digit number for the year, resulting in numbers (short text) such as this: 011456-05-15. I've made a form that has unbound controls for crafting the number. A textbox txtMaxSeqNo displays the value DMax("File_SeqNo","tblFiles") as a starting point. A button btnMakeNext runs the Event Procedure: Private Sub btnMakeNext_Click() TF_number.Value = Format(Int(txtMaxFileSeqNo) + 1, "000000") TF_month.Value = Left(CStr(Date), 2) TF_year.Value = Right(CStr(Date), 2) TF_Date.Value = Date End Sub I want to add these values as a new record to the existing tblFiles. Can I make a temp table from these values, append them to the real table, and delete the temp table? Can I craft a query from these unbound control values and use it to make a temp table, or to append directly to the real table? I'm not seeing how to capture the values from this form and put them eventually into the the real table. Ultimately, of course, all this will be behind the scenes, attached to a click event, but, while I'm building it, I want to see each step succeed before moving on. I'll appreciate ideas. TNF -- Tina Norris Fields tinanfields-at-torchlake-dot-com 231-322-2787 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From stuart at lexacorp.com.pg Tue Jun 2 16:59:19 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Wed, 03 Jun 2015 07:59:19 +1000 Subject: [AccessD] Can I do this? In-Reply-To: <6D6A4251EE0748049E5CBD3ACC1A4BF0@XPS> References: <556DD0FE.4070509@torchlake.com>, <6D6A4251EE0748049E5CBD3ACC1A4BF0@XPS> Message-ID: <556E2737.19213.361AB279@stuart.lexacorp.com.pg> I agree 100% with the danger of DMax in a multui-user situation. You need a function that grabs the next avaiable number and immediately update your FileSql_No with error trapping. (At times a second user *will* grab the FileSeq_No between the time a first user does and the time that first user writes the next higher number in. You need to trap this condition, a unique index on FileSeq_No will do it, and try again until you can successfully save the new number.) Also, I wouldn't store the file number like that. I would store the three components as separate numeric fields and build the complete number on the fly for display purposes. That will make it much easier to filter for all Jun 2015 files for example. On 2 Jun 2015 at 17:37, Jim Dettman wrote: > > Not sure I'm following the question... > > But first comment, if this is a multi-user situation, then using > Dmax() is > unreliable. > > I would have a procedure to generate the sequential number based on a > value > stored in a table. > > No need for all the unbound fields, as you can simply do: > > =GenerateKey("tblFiles") & "-" & Month(Date()) & "-" Day(Date()) > > You now have your key. With that, you can simply save it into the > main > table with either a SQL Insert or use a record set addnew. > > I have code for the GenerateKey() routine if you want it. > > Jim. > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of Tina Norris Fields Sent: Tuesday, June 02, 2015 11:51 AM To: > DatabaseAdvisors-Access Subject: [AccessD] Can I do this? > > I'm making a database for a local law firm. They have in place a > paper system that is complex, but, it works. They are sort of ready > to switch to an electronic system, but, it has to look just like the > paper system already in place. Once they know they can trust an > electronic system, they'll allow remodeling to simplify. That's the > situation. I'm working on a particular part of the system now, and > could use some help. > > A new file number is created from a six-digit sequential number, a > dash, a two-digit number for the month, a dash, and a two-digit number > for the year, resulting in numbers (short text) such as this: > 011456-05-15. > > I've made a form that has unbound controls for crafting the number. A > textbox txtMaxSeqNo displays the value DMax("File_SeqNo","tblFiles") > as a starting point. A button btnMakeNext runs the Event Procedure: > Private Sub btnMakeNext_Click() > TF_number.Value = Format(Int(txtMaxFileSeqNo) + 1, "000000") > TF_month.Value = Left(CStr(Date), 2) TF_year.Value = > Right(CStr(Date), 2) TF_Date.Value = Date > End Sub > > I want to add these values as a new record to the existing tblFiles. > Can I make a temp table from these values, append them to the real > table, and delete the temp table? Can I craft a query from these > unbound control values and use it to make a temp table, or to append > directly to the real table? I'm not seeing how to capture the values > from this form and put them eventually into the the real table. > > Ultimately, of course, all this will be behind the scenes, attached to > a click event, but, while I'm building it, I want to see each step > succeed before moving on. > > I'll appreciate ideas. > > TNF > > -- > Tina Norris Fields > tinanfields-at-torchlake-dot-com > 231-322-2787 > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From tinanfields at torchlake.com Tue Jun 2 20:36:09 2015 From: tinanfields at torchlake.com (Tina Norris Fields) Date: Tue, 02 Jun 2015 21:36:09 -0400 Subject: [AccessD] Can I do this? In-Reply-To: <6D6A4251EE0748049E5CBD3ACC1A4BF0@XPS> References: <556DD0FE.4070509@torchlake.com> <6D6A4251EE0748049E5CBD3ACC1A4BF0@XPS> Message-ID: <556E5A09.60804@torchlake.com> Thank you Jim, I would love to have the GenerateKey() routine. Thanks for the caution comment about DMax(). TNF Tina Norris Fields tinanfields-at-torchlake-dot-com 231-322-2787 On 06/02/15 5:37 PM, Jim Dettman wrote: > Not sure I'm following the question... > > But first comment, if this is a multi-user situation, then using Dmax() is > unreliable. > > I would have a procedure to generate the sequential number based on a value > stored in a table. > > No need for all the unbound fields, as you can simply do: > > =GenerateKey("tblFiles") & "-" & Month(Date()) & "-" Day(Date()) > > You now have your key. With that, you can simply save it into the main > table with either a SQL Insert or use a record set addnew. > > I have code for the GenerateKey() routine if you want it. > > Jim. > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Tina Norris Fields > Sent: Tuesday, June 02, 2015 11:51 AM > To: DatabaseAdvisors-Access > Subject: [AccessD] Can I do this? > > I'm making a database for a local law firm. They have in place a paper > system that is complex, but, it works. They are sort of ready to switch > to an electronic system, but, it has to look just like the paper system > already in place. Once they know they can trust an electronic system, > they'll allow remodeling to simplify. That's the situation. I'm > working on a particular part of the system now, and could use some help. > > A new file number is created from a six-digit sequential number, a dash, > a two-digit number for the month, a dash, and a two-digit number for the > year, resulting in numbers (short text) such as this: 011456-05-15. > > I've made a form that has unbound controls for crafting the number. > A textbox txtMaxSeqNo displays the value DMax("File_SeqNo","tblFiles") > as a starting point. > A button btnMakeNext runs the Event Procedure: > Private Sub btnMakeNext_Click() > TF_number.Value = Format(Int(txtMaxFileSeqNo) + 1, "000000") > TF_month.Value = Left(CStr(Date), 2) > TF_year.Value = Right(CStr(Date), 2) > TF_Date.Value = Date > End Sub > > I want to add these values as a new record to the existing tblFiles. > Can I make a temp table from these values, append them to the real > table, and delete the temp table? Can I craft a query from these > unbound control values and use it to make a temp table, or to append > directly to the real table? I'm not seeing how to capture the values > from this form and put them eventually into the the real table. > > Ultimately, of course, all this will be behind the scenes, attached to a > click event, but, while I'm building it, I want to see each step succeed > before moving on. > > I'll appreciate ideas. > > TNF > From tinanfields at torchlake.com Tue Jun 2 20:58:18 2015 From: tinanfields at torchlake.com (Tina Norris Fields) Date: Tue, 02 Jun 2015 21:58:18 -0400 Subject: [AccessD] Can I do this? In-Reply-To: <556E2737.19213.361AB279@stuart.lexacorp.com.pg> References: <556DD0FE.4070509@torchlake.com>, <6D6A4251EE0748049E5CBD3ACC1A4BF0@XPS> <556E2737.19213.361AB279@stuart.lexacorp.com.pg> Message-ID: <556E5F3A.7080300@torchlake.com> Hi Stuart, Thanks to both you and Jim for the caution about DMax(). This will be a multi-user situation, so I appreciate the warning. You're absolutely right about the need for error trapping; thanks for the suggestion to use a unique index on File_SeqNo. Yeah, about the completed file number - I like your idea better, too. I'll probably be back for more help in the next bit. Thanks again. TNF Tina Norris Fields tinanfields-at-torchlake-dot-com 231-322-2787 On 06/02/15 5:59 PM, Stuart McLachlan wrote: > I agree 100% with the danger of DMax in a multui-user situation. You need a function that > grabs the next avaiable number and immediately update your FileSql_No with error trapping. > > (At times a second user *will* grab the FileSeq_No between the time a first user does and the > time that first user writes the next higher number in. You need to trap this condition, a > unique index on FileSeq_No will do it, and try again until you can successfully save the new > number.) > > > Also, I wouldn't store the file number like that. I would store the three components as > separate numeric fields and build the complete number on the fly for display purposes. That > will make it much easier to filter for all Jun 2015 files for example. > > > > On 2 Jun 2015 at 17:37, Jim Dettman wrote: > >> Not sure I'm following the question... >> >> But first comment, if this is a multi-user situation, then using >> Dmax() is >> unreliable. >> >> I would have a procedure to generate the sequential number based on a >> value >> stored in a table. >> >> No need for all the unbound fields, as you can simply do: >> >> =GenerateKey("tblFiles") & "-" & Month(Date()) & "-" Day(Date()) >> >> You now have your key. With that, you can simply save it into the >> main >> table with either a SQL Insert or use a record set addnew. >> >> I have code for the GenerateKey() routine if you want it. >> >> Jim. >> >> -----Original Message----- >> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf >> Of Tina Norris Fields Sent: Tuesday, June 02, 2015 11:51 AM To: >> DatabaseAdvisors-Access Subject: [AccessD] Can I do this? >> >> I'm making a database for a local law firm. They have in place a >> paper system that is complex, but, it works. They are sort of ready >> to switch to an electronic system, but, it has to look just like the >> paper system already in place. Once they know they can trust an >> electronic system, they'll allow remodeling to simplify. That's the >> situation. I'm working on a particular part of the system now, and >> could use some help. >> >> A new file number is created from a six-digit sequential number, a >> dash, a two-digit number for the month, a dash, and a two-digit number >> for the year, resulting in numbers (short text) such as this: >> 011456-05-15. >> >> I've made a form that has unbound controls for crafting the number. A >> textbox txtMaxSeqNo displays the value DMax("File_SeqNo","tblFiles") >> as a starting point. A button btnMakeNext runs the Event Procedure: >> Private Sub btnMakeNext_Click() >> TF_number.Value = Format(Int(txtMaxFileSeqNo) + 1, "000000") >> TF_month.Value = Left(CStr(Date), 2) TF_year.Value = >> Right(CStr(Date), 2) TF_Date.Value = Date >> End Sub >> >> I want to add these values as a new record to the existing tblFiles. >> Can I make a temp table from these values, append them to the real >> table, and delete the temp table? Can I craft a query from these >> unbound control values and use it to make a temp table, or to append >> directly to the real table? I'm not seeing how to capture the values >> from this form and put them eventually into the the real table. >> >> Ultimately, of course, all this will be behind the scenes, attached to >> a click event, but, while I'm building it, I want to see each step >> succeed before moving on. >> >> I'll appreciate ideas. >> >> TNF >> >> -- >> Tina Norris Fields >> tinanfields-at-torchlake-dot-com >> 231-322-2787 >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> > From bensonforums at gmail.com Wed Jun 3 09:51:29 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 3 Jun 2015 10:51:29 -0400 Subject: [AccessD] Cross post - looking for way to reassociate controls with events Message-ID: Not long back on one of the lists, someone posted some great technique for re-associating controls with the event code (such as Click) in the form code module, when controls have been cut and pasted. I recently moved all my controls from the form to within the page of a tab control on the parent form. This caused all the event code to no longer be registered and I need that trick to get the associations back because there really is no other way besides re-selecting the events after inspecting the code by hand. Thanks. From rockysmolin at bchacc.com Wed Jun 3 09:59:35 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Wed, 3 Jun 2015 07:59:35 -0700 Subject: [AccessD] Cross post - looking for way to reassociate controls withevents In-Reply-To: References: Message-ID: I think (but not sure) my trek is to paste the code first. But can't remember for sure. But easy to try with one control. Paste the event code first, then paste the control. HTH Rocky -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Wednesday, June 03, 2015 7:51 AM To: Access Developers discussion and problem solving; Microsoft Access Database Discussion List Subject: [AccessD] Cross post - looking for way to reassociate controls withevents Not long back on one of the lists, someone posted some great technique for re-associating controls with the event code (such as Click) in the form code module, when controls have been cut and pasted. I recently moved all my controls from the form to within the page of a tab control on the parent form. This caused all the event code to no longer be registered and I need that trick to get the associations back because there really is no other way besides re-selecting the events after inspecting the code by hand. Thanks. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From gustav at cactus.dk Wed Jun 3 10:03:58 2015 From: gustav at cactus.dk (Gustav Brock) Date: Wed, 3 Jun 2015 15:03:58 +0000 Subject: [AccessD] Cross post - looking for way to reassociate controls with events Message-ID: Hi Bill That was in March: f you on a form decide to move some controls into a tab control, you normally do a cut and paste of these controls - from the form into a page of the tab control. Then all the events of the controls get cleared; the [Event Procedure] markings are gone and the code behind is detached though still present. To restore these settings, open the code module of the form: 1. Mark all code with Ctrl+A 2. Cut it away with Ctrl-X 3. Select menu Debug, Compile 4. Paste all the code back into the empty module with Ctrl-V 5. Select Debug, Compile Now your event procedures are hooked up again. I knew of this little trick but had forgotten the details and found it here after much searching: http://bytes.com/topic/access/answers/632851-detached-event-procedures /gustav -----Oprindelig meddelelse----- Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] P? vegne af Bill Benson Sendt: 3. juni 2015 16:51 Til: Access Developers discussion and problem solving; Microsoft Access Database Discussion List Emne: [AccessD] Cross post - looking for way to reassociate controls with events Not long back on one of the lists, someone posted some great technique for re-associating controls with the event code (such as Click) in the form code module, when controls have been cut and pasted. I recently moved all my controls from the form to within the page of a tab control on the parent form. This caused all the event code to no longer be registered and I need that trick to get the associations back because there really is no other way besides re-selecting the events after inspecting the code by hand. Thanks. From jwcolby at gmail.com Wed Jun 3 10:05:03 2015 From: jwcolby at gmail.com (John W. Colby) Date: Wed, 03 Jun 2015 11:05:03 -0400 Subject: [AccessD] Cross post - looking for way to reassociate controls withevents In-Reply-To: References: Message-ID: <556F179F.1000201@gmail.com> The other way around. Paste the even code (back) in after moving the controls. John W. Colby On 6/3/2015 10:59 AM, Rocky Smolin wrote: > I think (but not sure) my trek is to paste the code first. But can't > remember for sure. But easy to try with one control. Paste the event code > first, then paste the control. > > HTH > > Rocky > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Wednesday, June 03, 2015 7:51 AM > To: Access Developers discussion and problem solving; Microsoft Access > Database Discussion List > Subject: [AccessD] Cross post - looking for way to reassociate controls > withevents > > Not long back on one of the lists, someone posted some great technique for > re-associating controls with the event code (such as Click) in the form code > module, when controls have been cut and pasted. I recently moved all my > controls from the form to within the page of a tab control on the parent > form. This caused all the event code to no longer be registered and I need > that trick to get the associations back because there really is no other way > besides re-selecting the events after inspecting the code by hand. > > Thanks. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From rockysmolin at bchacc.com Wed Jun 3 10:08:40 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Wed, 3 Jun 2015 08:08:40 -0700 Subject: [AccessD] Cross post - looking for way to reassociate controls withevents In-Reply-To: <556F179F.1000201@gmail.com> References: <556F179F.1000201@gmail.com> Message-ID: <93BA876D68D243E291CFDE2D8AFDEC1D@HAL9007> Well I had a 50-50 chance... :) r -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Wednesday, June 03, 2015 8:05 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Cross post - looking for way to reassociate controls withevents The other way around. Paste the even code (back) in after moving the controls. John W. Colby On 6/3/2015 10:59 AM, Rocky Smolin wrote: > I think (but not sure) my trek is to paste the code first. But can't > remember for sure. But easy to try with one control. Paste the event > code first, then paste the control. > > HTH > > Rocky > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of Bill Benson > Sent: Wednesday, June 03, 2015 7:51 AM > To: Access Developers discussion and problem solving; Microsoft Access > Database Discussion List > Subject: [AccessD] Cross post - looking for way to reassociate > controls withevents > > Not long back on one of the lists, someone posted some great technique > for re-associating controls with the event code (such as Click) in the > form code module, when controls have been cut and pasted. I recently > moved all my controls from the form to within the page of a tab > control on the parent form. This caused all the event code to no > longer be registered and I need that trick to get the associations > back because there really is no other way besides re-selecting the events after inspecting the code by hand. > > Thanks. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Wed Jun 3 10:28:51 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 3 Jun 2015 11:28:51 -0400 Subject: [AccessD] Cross post - looking for way to reassociate controls withevents In-Reply-To: <93BA876D68D243E291CFDE2D8AFDEC1D@HAL9007> References: <556F179F.1000201@gmail.com> <93BA876D68D243E291CFDE2D8AFDEC1D@HAL9007> Message-ID: Thanks all. I will post these to Access-L as well. On Jun 3, 2015 11:09 AM, "Rocky Smolin" wrote: > Well I had a 50-50 chance... :) > > r > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > John W. Colby > Sent: Wednesday, June 03, 2015 8:05 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Cross post - looking for way to reassociate controls > withevents > > The other way around. Paste the even code (back) in after moving the > controls. > > John W. Colby > > On 6/3/2015 10:59 AM, Rocky Smolin wrote: > > I think (but not sure) my trek is to paste the code first. But can't > > remember for sure. But easy to try with one control. Paste the event > > code first, then paste the control. > > > > HTH > > > > Rocky > > > > > > -----Original Message----- > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > > Of Bill Benson > > Sent: Wednesday, June 03, 2015 7:51 AM > > To: Access Developers discussion and problem solving; Microsoft Access > > Database Discussion List > > Subject: [AccessD] Cross post - looking for way to reassociate > > controls withevents > > > > Not long back on one of the lists, someone posted some great technique > > for re-associating controls with the event code (such as Click) in the > > form code module, when controls have been cut and pasted. I recently > > moved all my controls from the form to within the page of a tab > > control on the parent form. This caused all the event code to no > > longer be registered and I need that trick to get the associations > > back because there really is no other way besides re-selecting the events > after inspecting the code by hand. > > > > Thanks. > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Wed Jun 3 10:53:30 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 3 Jun 2015 11:53:30 -0400 Subject: [AccessD] Cross post - looking for way to reassociate controls with events In-Reply-To: References: Message-ID: >From the other list (Gustav): Hi Bill That was in March: f you on a form decide to move some controls into a tab control, you normally do a cut and paste of these controls - from the form into a page of the tab control. Then all the events of the controls get cleared; the [Event Procedure] markings are gone and the code behind is detached though still present. To restore these settings, open the code module of the form: 1. Mark all code with Ctrl+A 2. Cut it away with Ctrl-X 3. Select menu Debug, Compile 4. Paste all the code back into the empty module with Ctrl-V 5. Select Debug, Compile Now your event procedures are hooked up again. I knew of this little trick but had forgotten the details and found it here after much searching: http://bytes.com/topic/access/answers/632851-detached-event-procedures /gustav Another (John Colby and Rocky Smolin): Paste the even[t] code (back) in after moving the controls. On Wed, Jun 3, 2015 at 10:51 AM, Bill Benson wrote: > Not long back on one of the lists, someone posted some great technique for > re-associating controls with the event code (such as Click) in the form > code module, when controls have been cut and pasted. I recently moved all > my controls from the form to within the page of a tab control on the parent > form. This caused all the event code to no longer be registered and I need > that trick to get the associations back because there really is no other > way besides re-selecting the events after inspecting the code by hand. > > Thanks. > From davidmcafee at gmail.com Wed Jun 3 19:30:09 2015 From: davidmcafee at gmail.com (David McAfee) Date: Wed, 3 Jun 2015 17:30:09 -0700 Subject: [AccessD] Select Exported Files from Access Message-ID: I have some VBA that loops through a recordset and exports some reports as PDFs. When the process is done, I open the folder to display the files, using the following: Application.FollowHyperlink [Path] I'd like to be able to select the files that were exported, to make it easier for the user to see. I Know they can sort the folder by date, I'm just wondering if it's possible to select the files. Thanks, David From bensonforums at gmail.com Wed Jun 3 19:52:16 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 3 Jun 2015 20:52:16 -0400 Subject: [AccessD] Select Exported Files from Access In-Reply-To: References: Message-ID: This article looks promising and simar to what you have requested, though you would come at the list of files slightly differently. http://stackoverflow.com/questions/25693848/how-to-select-multiple-files-in-windows-explorer-from-selected-cells-in-excel-us For some other approaches, Could display the file names in a list box instead of forcing open windows explorer? Of course thwt wont permit the user to do all they need with them perhsps. And for that matter, could you not simply export each batch to a reporting subfolder named for the run date, rather than to a folder collecting all reports? For another twist, keep only the most recently generated reports in the production reports folder and move out all others to an archive subfolder with each run. Then no need to select anything. Just some alternative approaches if you cannot force-select files in the windows explorer. I don't mind waiting for others to comment. On Jun 3, 2015 8:31 PM, "David McAfee" wrote: > I have some VBA that loops through a recordset and exports some reports as > PDFs. > When the process is done, I open the folder to display the files, using the > following: > > Application.FollowHyperlink [Path] > > I'd like to be able to select the files that were exported, to make it > easier for the user to see. > > I Know they can sort the folder by date, I'm just wondering if it's > possible to select the files. > > Thanks, > David > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From stuart at lexacorp.com.pg Wed Jun 3 20:00:25 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 04 Jun 2015 11:00:25 +1000 Subject: [AccessD] Select Exported Files from Access In-Reply-To: References: Message-ID: <556FA329.16543.3BE6DE96@stuart.lexacorp.com.pg> I dan't think of a way off hand, but it raises the question of what you are trying to achieve. Why are you displaying the folder? What do the users do with the files. There may well be alternative methods to achieve the desired result. Such as displaying a listview with the file names for the user to act on rather than a shell folder. -- Stuart On 3 Jun 2015 at 17:30, David McAfee wrote: > I have some VBA that loops through a recordset and exports some > reports as PDFs. When the process is done, I open the folder to > display the files, using the following: > > Application.FollowHyperlink [Path] > > I'd like to be able to select the files that were exported, to make it > easier for the user to see. > > I Know they can sort the folder by date, I'm just wondering if it's > possible to select the files. > > Thanks, > David > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Wed Jun 3 20:04:21 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 3 Jun 2015 21:04:21 -0400 Subject: [AccessD] Select Exported Files from Access In-Reply-To: <556FA329.16543.3BE6DE96@stuart.lexacorp.com.pg> References: <556FA329.16543.3BE6DE96@stuart.lexacorp.com.pg> Message-ID: Yeah good questions and points Stuart. On Jun 3, 2015 9:01 PM, "Stuart McLachlan" wrote: > I dan't think of a way off hand, but it raises the question of what you > are trying to achieve. > > Why are you displaying the folder? What do the users do with the files. > > There may well be alternative methods to achieve the desired result. Such > as displaying a > listview with the file names for the user to act on rather than a shell > folder. > > -- > Stuart > > > > On 3 Jun 2015 at 17:30, David McAfee wrote: > > > I have some VBA that loops through a recordset and exports some > > reports as PDFs. When the process is done, I open the folder to > > display the files, using the following: > > > > Application.FollowHyperlink [Path] > > > > I'd like to be able to select the files that were exported, to make it > > easier for the user to see. > > > > I Know they can sort the folder by date, I'm just wondering if it's > > possible to select the files. > > > > Thanks, > > David > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From rockysmolin at bchacc.com Wed Jun 3 22:34:12 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Wed, 3 Jun 2015 20:34:12 -0700 Subject: [AccessD] Select Exported Files from Access In-Reply-To: References: Message-ID: <306F12CF2128441FB47C10B6A481AE87@HAL9007> I'd like to know how you're making the PDFs from VBA. I had an app once years ago that used a 3rd party but it's unstable. No immediate need, but that would be a really useful thing. I tell my clients who want a pdf to install PrimoPDF and ctrl-P from the preview and select Primo as their printer. So far, that seems to satisfy everyone. TIA Rocky -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM To: Access Developers discussion and problem solving Subject: [AccessD] Select Exported Files from Access I have some VBA that loops through a recordset and exports some reports as PDFs. When the process is done, I open the folder to display the files, using the following: Application.FollowHyperlink [Path] I'd like to be able to select the files that were exported, to make it easier for the user to see. I Know they can sort the folder by date, I'm just wondering if it's possible to select the files. Thanks, David -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From jbodin at sbor.com Wed Jun 3 22:39:58 2015 From: jbodin at sbor.com (John Bodin) Date: Thu, 4 Jun 2015 03:39:58 +0000 Subject: [AccessD] Select Exported Files from Access In-Reply-To: <306F12CF2128441FB47C10B6A481AE87@HAL9007> References: <306F12CF2128441FB47C10B6A481AE87@HAL9007> Message-ID: I've been using PDF995 for years. Works very well and works on Citrix too, if you have any apps running over that. Sample code on web-site. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin Sent: Wednesday, June 03, 2015 11:34 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Select Exported Files from Access I'd like to know how you're making the PDFs from VBA. I had an app once years ago that used a 3rd party but it's unstable. No immediate need, but that would be a really useful thing. I tell my clients who want a pdf to install PrimoPDF and ctrl-P from the preview and select Primo as their printer. So far, that seems to satisfy everyone. TIA Rocky -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM To: Access Developers discussion and problem solving Subject: [AccessD] Select Exported Files from Access I have some VBA that loops through a recordset and exports some reports as PDFs. When the process is done, I open the folder to display the files, using the following: Application.FollowHyperlink [Path] I'd like to be able to select the files that were exported, to make it easier for the user to see. I Know they can sort the folder by date, I'm just wondering if it's possible to select the files. Thanks, David -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From stuart at lexacorp.com.pg Wed Jun 3 22:54:43 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 04 Jun 2015 13:54:43 +1000 Subject: [AccessD] Select Exported Files from Access In-Reply-To: <306F12CF2128441FB47C10B6A481AE87@HAL9007> References: , <306F12CF2128441FB47C10B6A481AE87@HAL9007> Message-ID: <556FCC03.12977.3C867201@stuart.lexacorp.com.pg> With recent versions of Access (possibly 2007, definitely 2010 on), ExportToPDF is built in: Docmd.OutputTo acOutputReport,"rptReport",acFormatPDF,"Report.pdf" -- Stuart On 3 Jun 2015 at 20:34, Rocky Smolin wrote: > I'd like to know how you're making the PDFs from VBA. I had an app > once years ago that used a 3rd party but it's unstable. No immediate > need, but that would be a really useful thing. > > I tell my clients who want a pdf to install PrimoPDF and ctrl-P from > the preview and select Primo as their printer. So far, that seems to > satisfy everyone. > > TIA > > Rocky > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM To: Access > Developers discussion and problem solving Subject: [AccessD] Select > Exported Files from Access > > I have some VBA that loops through a recordset and exports some > reports as PDFs. When the process is done, I open the folder to > display the files, using the following: > > Application.FollowHyperlink [Path] > > I'd like to be able to select the files that were exported, to make it > easier for the user to see. > > I Know they can sort the folder by date, I'm just wondering if it's > possible to select the files. > > Thanks, > David > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Wed Jun 3 22:58:20 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 3 Jun 2015 23:58:20 -0400 Subject: [AccessD] Select Exported Files from Access In-Reply-To: <556FCC03.12977.3C867201@stuart.lexacorp.com.pg> References: <306F12CF2128441FB47C10B6A481AE87@HAL9007> <556FCC03.12977.3C867201@stuart.lexacorp.com.pg> Message-ID: Don't you need the full path, not just "Report.pdf" ? On Jun 3, 2015 11:55 PM, "Stuart McLachlan" wrote: > With recent versions of Access (possibly 2007, definitely 2010 on), > ExportToPDF is built in: > > Docmd.OutputTo acOutputReport,"rptReport",acFormatPDF,"Report.pdf" > > -- > Stuart > > On 3 Jun 2015 at 20:34, Rocky Smolin wrote: > > > I'd like to know how you're making the PDFs from VBA. I had an app > > once years ago that used a 3rd party but it's unstable. No immediate > > need, but that would be a really useful thing. > > > > I tell my clients who want a pdf to install PrimoPDF and ctrl-P from > > the preview and select Primo as their printer. So far, that seems to > > satisfy everyone. > > > > TIA > > > > Rocky > > > > > > -----Original Message----- > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > > Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM To: Access > > Developers discussion and problem solving Subject: [AccessD] Select > > Exported Files from Access > > > > I have some VBA that loops through a recordset and exports some > > reports as PDFs. When the process is done, I open the folder to > > display the files, using the following: > > > > Application.FollowHyperlink [Path] > > > > I'd like to be able to select the files that were exported, to make it > > easier for the user to see. > > > > I Know they can sort the folder by date, I'm just wondering if it's > > possible to select the files. > > > > Thanks, > > David > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From stuart at lexacorp.com.pg Wed Jun 3 23:08:50 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 04 Jun 2015 14:08:50 +1000 Subject: [AccessD] Select Exported Files from Access In-Reply-To: References: , <556FCC03.12977.3C867201@stuart.lexacorp.com.pg>, Message-ID: <556FCF52.10415.3C935C8E@stuart.lexacorp.com.pg> Only if you don't want it to go into the default directory (usually My Documents) On 3 Jun 2015 at 23:58, Bill Benson wrote: > Don't you need the full path, not just "Report.pdf" ? > On Jun 3, 2015 11:55 PM, "Stuart McLachlan" > wrote: > > > With recent versions of Access (possibly 2007, definitely 2010 on), > > ExportToPDF is built in: > > > > Docmd.OutputTo acOutputReport,"rptReport",acFormatPDF,"Report.pdf" > > > > -- > > Stuart > > > > On 3 Jun 2015 at 20:34, Rocky Smolin wrote: > > > > > I'd like to know how you're making the PDFs from VBA. I had an > > > app once years ago that used a 3rd party but it's unstable. No > > > immediate need, but that would be a really useful thing. > > > > > > I tell my clients who want a pdf to install PrimoPDF and ctrl-P > > > from the preview and select Primo as their printer. So far, that > > > seems to satisfy everyone. > > > > > > TIA > > > > > > Rocky > > > > > > > > > -----Original Message----- > > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On > > > Behalf Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM To: > > > Access Developers discussion and problem solving Subject: > > > [AccessD] Select Exported Files from Access > > > > > > I have some VBA that loops through a recordset and exports some > > > reports as PDFs. When the process is done, I open the folder to > > > display the files, using the following: > > > > > > Application.FollowHyperlink [Path] > > > > > > I'd like to be able to select the files that were exported, to > > > make it easier for the user to see. > > > > > > I Know they can sort the folder by date, I'm just wondering if > > > it's possible to select the files. > > > > > > Thanks, > > > David > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Wed Jun 3 23:32:09 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 4 Jun 2015 00:32:09 -0400 Subject: [AccessD] Select Exported Files from Access In-Reply-To: <556FCF52.10415.3C935C8E@stuart.lexacorp.com.pg> References: <556FCC03.12977.3C867201@stuart.lexacorp.com.pg> <556FCF52.10415.3C935C8E@stuart.lexacorp.com.pg> Message-ID: Ok, but it's rare that one would, no? I think it is best to include the path, but that is me. Glad to know there is a choice. On Jun 4, 2015 12:10 AM, "Stuart McLachlan" wrote: > Only if you don't want it to go into the default directory (usually My > Documents) > > > > On 3 Jun 2015 at 23:58, Bill Benson wrote: > > > Don't you need the full path, not just "Report.pdf" ? > > On Jun 3, 2015 11:55 PM, "Stuart McLachlan" > > wrote: > > > > > With recent versions of Access (possibly 2007, definitely 2010 on), > > > ExportToPDF is built in: > > > > > > Docmd.OutputTo acOutputReport,"rptReport",acFormatPDF,"Report.pdf" > > > > > > -- > > > Stuart > > > > > > On 3 Jun 2015 at 20:34, Rocky Smolin wrote: > > > > > > > I'd like to know how you're making the PDFs from VBA. I had an > > > > app once years ago that used a 3rd party but it's unstable. No > > > > immediate need, but that would be a really useful thing. > > > > > > > > I tell my clients who want a pdf to install PrimoPDF and ctrl-P > > > > from the preview and select Primo as their printer. So far, that > > > > seems to satisfy everyone. > > > > > > > > TIA > > > > > > > > Rocky > > > > > > > > > > > > -----Original Message----- > > > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On > > > > Behalf Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM To: > > > > Access Developers discussion and problem solving Subject: > > > > [AccessD] Select Exported Files from Access > > > > > > > > I have some VBA that loops through a recordset and exports some > > > > reports as PDFs. When the process is done, I open the folder to > > > > display the files, using the following: > > > > > > > > Application.FollowHyperlink [Path] > > > > > > > > I'd like to be able to select the files that were exported, to > > > > make it easier for the user to see. > > > > > > > > I Know they can sort the folder by date, I'm just wondering if > > > > it's possible to select the files. > > > > > > > > Thanks, > > > > David > > > > -- > > > > AccessD mailing list > > > > AccessD at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > Website: http://www.databaseadvisors.com > > > > > > > > -- > > > > AccessD mailing list > > > > AccessD at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > Website: http://www.databaseadvisors.com > > > > > > > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From stuart at lexacorp.com.pg Wed Jun 3 23:51:48 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 04 Jun 2015 14:51:48 +1000 Subject: [AccessD] Select Exported Files from Access In-Reply-To: References: , <556FCF52.10415.3C935C8E@stuart.lexacorp.com.pg>, Message-ID: <556FD964.20144.3CBAB327@stuart.lexacorp.com.pg> I do include the path in real code, frequently in a string which includes "currentproject.path". That was just an ultra-simplified example. -- Stuart On 4 Jun 2015 at 0:32, Bill Benson wrote: > Ok, but it's rare that one would, no? I think it is best to include > the path, but that is me. Glad to know there is a choice. On Jun 4, > 2015 12:10 AM, "Stuart McLachlan" wrote: > > > Only if you don't want it to go into the default directory (usually > > My Documents) > > > > > > > > On 3 Jun 2015 at 23:58, Bill Benson wrote: > > > > > Don't you need the full path, not just "Report.pdf" ? > > > On Jun 3, 2015 11:55 PM, "Stuart McLachlan" > > > wrote: > > > > > > > With recent versions of Access (possibly 2007, definitely 2010 > > > > on), ExportToPDF is built in: > > > > > > > > Docmd.OutputTo > > > > acOutputReport,"rptReport",acFormatPDF,"Report.pdf" > > > > > > > > -- > > > > Stuart > > > > > > > > On 3 Jun 2015 at 20:34, Rocky Smolin wrote: > > > > > > > > > I'd like to know how you're making the PDFs from VBA. I had > > > > > an app once years ago that used a 3rd party but it's unstable. > > > > > No immediate need, but that would be a really useful thing. > > > > > > > > > > I tell my clients who want a pdf to install PrimoPDF and > > > > > ctrl-P from the preview and select Primo as their printer. So > > > > > far, that seems to satisfy everyone. > > > > > > > > > > TIA > > > > > > > > > > Rocky > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On > > > > > Behalf Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM > > > > > To: Access Developers discussion and problem solving Subject: > > > > > [AccessD] Select Exported Files from Access > > > > > > > > > > I have some VBA that loops through a recordset and exports > > > > > some reports as PDFs. When the process is done, I open the > > > > > folder to display the files, using the following: > > > > > > > > > > Application.FollowHyperlink [Path] > > > > > > > > > > I'd like to be able to select the files that were exported, to > > > > > make it easier for the user to see. > > > > > > > > > > I Know they can sort the folder by date, I'm just wondering if > > > > > it's possible to select the files. > > > > > > > > > > Thanks, > > > > > David > > > > > -- > > > > > AccessD mailing list > > > > > AccessD at databaseadvisors.com > > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > > Website: http://www.databaseadvisors.com > > > > > > > > > > -- > > > > > AccessD mailing list > > > > > AccessD at databaseadvisors.com > > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > > Website: http://www.databaseadvisors.com > > > > > > > > > > > > > > > > > -- > > > > AccessD mailing list > > > > AccessD at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > Website: http://www.databaseadvisors.com > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From paul.hartland at googlemail.com Thu Jun 4 00:06:39 2015 From: paul.hartland at googlemail.com (Paul Hartland) Date: Thu, 4 Jun 2015 06:06:39 +0100 Subject: [AccessD] Select Exported Files from Access In-Reply-To: <556FD964.20144.3CBAB327@stuart.lexacorp.com.pg> References: <556FCF52.10415.3C935C8E@stuart.lexacorp.com.pg> <556FD964.20144.3CBAB327@stuart.lexacorp.com.pg> Message-ID: I have done something similar in the past, I would create a public array and add the path/filename into the array, when all the files had finished exporting I would put use that array to populate either a listbox or subform to pop up on the screen allowing the user to select either one or all of the files to open. Paul On 4 June 2015 at 05:51, Stuart McLachlan wrote: > I do include the path in real code, frequently in a string which includes > "currentproject.path". > > That was just an ultra-simplified example. > > -- > Stuart > > On 4 Jun 2015 at 0:32, Bill Benson wrote: > > > Ok, but it's rare that one would, no? I think it is best to include > > the path, but that is me. Glad to know there is a choice. On Jun 4, > > 2015 12:10 AM, "Stuart McLachlan" wrote: > > > > > Only if you don't want it to go into the default directory (usually > > > My Documents) > > > > > > > > > > > > On 3 Jun 2015 at 23:58, Bill Benson wrote: > > > > > > > Don't you need the full path, not just "Report.pdf" ? > > > > On Jun 3, 2015 11:55 PM, "Stuart McLachlan" > > > > wrote: > > > > > > > > > With recent versions of Access (possibly 2007, definitely 2010 > > > > > on), ExportToPDF is built in: > > > > > > > > > > Docmd.OutputTo > > > > > acOutputReport,"rptReport",acFormatPDF,"Report.pdf" > > > > > > > > > > -- > > > > > Stuart > > > > > > > > > > On 3 Jun 2015 at 20:34, Rocky Smolin wrote: > > > > > > > > > > > I'd like to know how you're making the PDFs from VBA. I had > > > > > > an app once years ago that used a 3rd party but it's unstable. > > > > > > No immediate need, but that would be a really useful thing. > > > > > > > > > > > > I tell my clients who want a pdf to install PrimoPDF and > > > > > > ctrl-P from the preview and select Primo as their printer. So > > > > > > far, that seems to satisfy everyone. > > > > > > > > > > > > TIA > > > > > > > > > > > > Rocky > > > > > > > > > > > > > > > > > > -----Original Message----- > > > > > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On > > > > > > Behalf Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM > > > > > > To: Access Developers discussion and problem solving Subject: > > > > > > [AccessD] Select Exported Files from Access > > > > > > > > > > > > I have some VBA that loops through a recordset and exports > > > > > > some reports as PDFs. When the process is done, I open the > > > > > > folder to display the files, using the following: > > > > > > > > > > > > Application.FollowHyperlink [Path] > > > > > > > > > > > > I'd like to be able to select the files that were exported, to > > > > > > make it easier for the user to see. > > > > > > > > > > > > I Know they can sort the folder by date, I'm just wondering if > > > > > > it's possible to select the files. > > > > > > > > > > > > Thanks, > > > > > > David > > > > > > -- > > > > > > AccessD mailing list > > > > > > AccessD at databaseadvisors.com > > > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > > > Website: http://www.databaseadvisors.com > > > > > > > > > > > > -- > > > > > > AccessD mailing list > > > > > > AccessD at databaseadvisors.com > > > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > > > Website: http://www.databaseadvisors.com > > > > > > > > > > > > > > > > > > > > > -- > > > > > AccessD mailing list > > > > > AccessD at databaseadvisors.com > > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > > Website: http://www.databaseadvisors.com > > > > > > > > > -- > > > > AccessD mailing list > > > > AccessD at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > Website: http://www.databaseadvisors.com > > > > > > > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- Paul Hartland paul.hartland at googlemail.com From fuller.artful at gmail.com Thu Jun 4 07:06:00 2015 From: fuller.artful at gmail.com (Arthur Fuller) Date: Thu, 4 Jun 2015 08:06:00 -0400 Subject: [AccessD] Puzzling problem with querying Message-ID: Running Access 2007. When trying to open an existing query (almost all of them), or create a new one, I keep getting an error message that reads, '' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long. When I look at the SQL view of a query, it all looks correct, and in fact runs correctly as well. Any idea what might be causing this error message to appear? -- Arthur From paul.hartland at googlemail.com Thu Jun 4 07:09:03 2015 From: paul.hartland at googlemail.com (Paul Hartland) Date: Thu, 4 Jun 2015 13:09:03 +0100 Subject: [AccessD] Puzzling problem with querying In-Reply-To: References: Message-ID: Would imagine you have already checked this but is it two single quotes instead of a double quote On 4 Jun 2015 13:07, "Arthur Fuller" wrote: > Running Access 2007. When trying to open an existing query (almost all of > them), or create a new one, I keep getting an error message that reads, > > '' is not a valid name. Make sure that it does not include invalid > characters or punctuation and that it is not too long. > > When I look at the SQL view of a query, it all looks correct, and in fact > runs correctly as well. Any idea what might be causing this error message > to appear? > > -- > Arthur > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From fuller.artful at gmail.com Thu Jun 4 08:29:07 2015 From: fuller.artful at gmail.com (Arthur Fuller) Date: Thu, 4 Jun 2015 09:29:07 -0400 Subject: [AccessD] Puzzling problem with querying In-Reply-To: References: Message-ID: Paul, Unfortunately I cannot select the text in the error message, so I really have no way to distinguish where it's a pair of singles or one double. On Thu, Jun 4, 2015 at 8:09 AM, Paul Hartland wrote: > Would imagine you have already checked this but is it two single quotes > instead of a double quote From Salato at ky.gov Thu Jun 4 08:49:08 2015 From: Salato at ky.gov (FW Salato Center) Date: Thu, 4 Jun 2015 13:49:08 +0000 Subject: [AccessD] Puzzling problem with querying In-Reply-To: References: Message-ID: They were working fine before...? Susan H. Running Access 2007. When trying to open an existing query (almost all of them), or create a new one, I keep getting an error message that reads, '' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long. When I look at the SQL view of a query, it all looks correct, and in fact runs correctly as well. Any idea what might be causing this error message to appear? From fuller.artful at gmail.com Thu Jun 4 09:22:07 2015 From: fuller.artful at gmail.com (Arthur Fuller) Date: Thu, 4 Jun 2015 10:22:07 -0400 Subject: [AccessD] Puzzling problem with querying In-Reply-To: References: Message-ID: It gets a little stranger. Now the display is being sent to the external monitor, but the laptop still thinks that I only have one monitor, so I'm unable to extend the display across both. It's the same image on both. But at least that's a small step forward. All I did to achieve this was turn the external monitor off for a day; I turned it on this morning, expecting nothing, but for some reason got the display. A. On Thu, Jun 4, 2015 at 9:49 AM, FW Salato Center wrote: > They were working fine before...? From davidmcafee at gmail.com Thu Jun 4 12:02:59 2015 From: davidmcafee at gmail.com (David McAfee) Date: Thu, 4 Jun 2015 10:02:59 -0700 Subject: [AccessD] Select Exported Files from Access In-Reply-To: <556FCC03.12977.3C867201@stuart.lexacorp.com.pg> References: <306F12CF2128441FB47C10B6A481AE87@HAL9007> <556FCC03.12977.3C867201@stuart.lexacorp.com.pg> Message-ID: In 2007, i couldn't get it to work with acFormatPDF. I had to use the example below that I found online (ShowPdf is a boolean that you can toggle to open the PDFs as they are created): DoCmd.OutputTo acOutputReport, reportName, "PDFFormat(*.pdf)", (Path & FileName), ShowPdf, "", 0 As for why I am doing it... I started a new job with a non-profit company last year. I felt like I was thrown back into 1999. >From Working with MVC C# FE & SQL BE at my last job to working with Excel files being exported and passed around, edited and re-imported in to Access databases. I've almost forgotten how to interact with .mdbs as my last 15 years dealt mainly with ADPs when working with Access. I am slowly trying to automate most tasks, but change is not well received here. Most feel like I am trying to take their jobs away, so I have to do many things in baby steps, only automating small portions of the task until they "get it" then I automate more of the task. I am slowly making progress with their trust of the automation. It's funny, yesterday I was asked to accompany my boss over at another location to discuss "issues" with the division director. My latest automated report was missing 18 records that the employee had manually done. I quickly found that 14 were due to the user using a different date range, 3 should not have been on the manual report and 1 was due to transposed numbers by the user (or someone that passed them the information). The director now trusts the automated report. :) On Wed, Jun 3, 2015 at 8:54 PM, Stuart McLachlan wrote: > With recent versions of Access (possibly 2007, definitely 2010 on), > ExportToPDF is built in: > > Docmd.OutputTo acOutputReport,"rptReport",acFormatPDF,"Report.pdf" > > -- > Stuart > > On 3 Jun 2015 at 20:34, Rocky Smolin wrote: > > > I'd like to know how you're making the PDFs from VBA. I had an app > > once years ago that used a 3rd party but it's unstable. No immediate > > need, but that would be a really useful thing. > > > > I tell my clients who want a pdf to install PrimoPDF and ctrl-P from > > the preview and select Primo as their printer. So far, that seems to > > satisfy everyone. > > > > TIA > > > > Rocky > > > > > > -----Original Message----- > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > > Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM To: Access > > Developers discussion and problem solving Subject: [AccessD] Select > > Exported Files from Access > > > > I have some VBA that loops through a recordset and exports some > > reports as PDFs. When the process is done, I open the folder to > > display the files, using the following: > > > > Application.FollowHyperlink [Path] > > > > I'd like to be able to select the files that were exported, to make it > > easier for the user to see. > > > > I Know they can sort the folder by date, I'm just wondering if it's > > possible to select the files. > > > > Thanks, > > David > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From accessd at shaw.ca Thu Jun 4 12:58:23 2015 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 4 Jun 2015 11:58:23 -0600 (MDT) Subject: [AccessD] Puzzling problem with querying In-Reply-To: Message-ID: <1140433025.89272288.1433440703590.JavaMail.root@shaw.ca> Actually you can capture the text in most, if not all error messages, that remain displayed on the screen. Just left-mouse-click, hold down and move over the text as if you were capturing it, like in any document and ctrl-c or right-mouse click...select copy. Then bring up a note window, click and ctrl-v or right-mouse click...select paste. If you have done everything right the text you dragged over, even though it did not highlight, should then display. Jim ----- Original Message ----- From: "Arthur Fuller" To: "Access Developers discussion and problem solving" Sent: Thursday, June 4, 2015 6:29:07 AM Subject: Re: [AccessD] Puzzling problem with querying Paul, Unfortunately I cannot select the text in the error message, so I really have no way to distinguish where it's a pair of singles or one double. On Thu, Jun 4, 2015 at 8:09 AM, Paul Hartland wrote: > Would imagine you have already checked this but is it two single quotes > instead of a double quote -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From accessd at shaw.ca Thu Jun 4 13:14:57 2015 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 4 Jun 2015 12:14:57 -0600 (MDT) Subject: [AccessD] Select Exported Files from Access In-Reply-To: Message-ID: <1600116742.89286415.1433441697772.JavaMail.root@shaw.ca> I suspect when you got into the computer business, you did not think that being a first class negotiator was one of your most important job requirements. ;-) Jim ----- Original Message ----- From: "David McAfee" To: "Access Developers discussion and problem solving" Sent: Thursday, June 4, 2015 10:02:59 AM Subject: Re: [AccessD] Select Exported Files from Access In 2007, i couldn't get it to work with acFormatPDF. I had to use the example below that I found online (ShowPdf is a boolean that you can toggle to open the PDFs as they are created): DoCmd.OutputTo acOutputReport, reportName, "PDFFormat(*.pdf)", (Path & FileName), ShowPdf, "", 0 As for why I am doing it... I started a new job with a non-profit company last year. I felt like I was thrown back into 1999. >From Working with MVC C# FE & SQL BE at my last job to working with Excel files being exported and passed around, edited and re-imported in to Access databases. I've almost forgotten how to interact with .mdbs as my last 15 years dealt mainly with ADPs when working with Access. I am slowly trying to automate most tasks, but change is not well received here. Most feel like I am trying to take their jobs away, so I have to do many things in baby steps, only automating small portions of the task until they "get it" then I automate more of the task. I am slowly making progress with their trust of the automation. It's funny, yesterday I was asked to accompany my boss over at another location to discuss "issues" with the division director. My latest automated report was missing 18 records that the employee had manually done. I quickly found that 14 were due to the user using a different date range, 3 should not have been on the manual report and 1 was due to transposed numbers by the user (or someone that passed them the information). The director now trusts the automated report. :) On Wed, Jun 3, 2015 at 8:54 PM, Stuart McLachlan wrote: > With recent versions of Access (possibly 2007, definitely 2010 on), > ExportToPDF is built in: > > Docmd.OutputTo acOutputReport,"rptReport",acFormatPDF,"Report.pdf" > > -- > Stuart > > On 3 Jun 2015 at 20:34, Rocky Smolin wrote: > > > I'd like to know how you're making the PDFs from VBA. I had an app > > once years ago that used a 3rd party but it's unstable. No immediate > > need, but that would be a really useful thing. > > > > I tell my clients who want a pdf to install PrimoPDF and ctrl-P from > > the preview and select Primo as their printer. So far, that seems to > > satisfy everyone. > > > > TIA > > > > Rocky > > > > > > -----Original Message----- > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > > Of David McAfee Sent: Wednesday, June 03, 2015 5:30 PM To: Access > > Developers discussion and problem solving Subject: [AccessD] Select > > Exported Files from Access > > > > I have some VBA that loops through a recordset and exports some > > reports as PDFs. When the process is done, I open the folder to > > display the files, using the following: > > > > Application.FollowHyperlink [Path] > > > > I'd like to be able to select the files that were exported, to make it > > easier for the user to see. > > > > I Know they can sort the folder by date, I'm just wondering if it's > > possible to select the files. > > > > Thanks, > > David > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From davidmcafee at gmail.com Thu Jun 4 13:33:04 2015 From: davidmcafee at gmail.com (David McAfee) Date: Thu, 4 Jun 2015 11:33:04 -0700 Subject: [AccessD] Select Exported Files from Access In-Reply-To: <1600116742.89286415.1433441697772.JavaMail.root@shaw.ca> References: <1600116742.89286415.1433441697772.JavaMail.root@shaw.ca> Message-ID: Although I've been playing with computers since I was a kid, I didn't get into programming as a career until the early 90s. I couldn't stand the database software that we were using (Rbase, btrieve & great plains) and decided to make a new app to handle the Rbase part of it. We, the users always had to write down certain information on post it pads only to have to type it in on the next screen. I made sure that went away in my app. I also started to bring in information from the other software packages and displaying it on the same screen so they didn't have to switch between other programs. The other users LOVED the software as it made their job (phone support) much easier (more efficient). I rarely had to negotiate. Changes were understood and well received. I left the company in 2004 and went to another company for 10 years. That company, like this one, had many users that did not like change, even if it made their lives easier. That's when I became a negotiator. ;) Now, back to dealing with PK-less tables joined against excel links and trying to figure out why there are duplicate records :) Sigh... On Thu, Jun 4, 2015 at 11:14 AM, Jim Lawrence wrote: > I suspect when you got into the computer business, you did not think that > being a first class negotiator was one of your most important job > requirements. ;-) > > Jim > > From accessd at shaw.ca Thu Jun 4 14:25:31 2015 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 4 Jun 2015 13:25:31 -0600 (MDT) Subject: [AccessD] Select Exported Files from Access In-Reply-To: Message-ID: <1739056593.89336373.1433445931445.JavaMail.root@shaw.ca> Looking at the number of XP versions still in active duty lets us know how resistant to change so many people have become. If you want to see resistance and learn the finer points of negotiation, try to change an office from XP to Linux. ;-) Jim ----- Original Message ----- From: "David McAfee" To: "Access Developers discussion and problem solving" Sent: Thursday, June 4, 2015 11:33:04 AM Subject: Re: [AccessD] Select Exported Files from Access Although I've been playing with computers since I was a kid, I didn't get into programming as a career until the early 90s. I couldn't stand the database software that we were using (Rbase, btrieve & great plains) and decided to make a new app to handle the Rbase part of it. We, the users always had to write down certain information on post it pads only to have to type it in on the next screen. I made sure that went away in my app. I also started to bring in information from the other software packages and displaying it on the same screen so they didn't have to switch between other programs. The other users LOVED the software as it made their job (phone support) much easier (more efficient). I rarely had to negotiate. Changes were understood and well received. I left the company in 2004 and went to another company for 10 years. That company, like this one, had many users that did not like change, even if it made their lives easier. That's when I became a negotiator. ;) Now, back to dealing with PK-less tables joined against excel links and trying to figure out why there are duplicate records :) Sigh... On Thu, Jun 4, 2015 at 11:14 AM, Jim Lawrence wrote: > I suspect when you got into the computer business, you did not think that > being a first class negotiator was one of your most important job > requirements. ;-) > > Jim > > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Thu Jun 4 14:50:11 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 4 Jun 2015 15:50:11 -0400 Subject: [AccessD] Select Exported Files from Access In-Reply-To: References: <1600116742.89286415.1433441697772.JavaMail.root@shaw.ca> Message-ID: Needs Group By? too simplistic I am sure... but I always had to do that in GE databases which had false "index" columns which were not really as unique as they thought... On Thu, Jun 4, 2015 at 2:33 PM, David McAfee wrote: > Although I've been playing with computers since I was a kid, I didn't get > into programming as a career until the early 90s. > > I couldn't stand the database software that we were using (Rbase, btrieve & > great plains) and decided to make a new > app to handle the Rbase part of it. We, the users always had to write down > certain information on post it pads only to > have to type it in on the next screen. I made sure that went away in my > app. > > > I also started to bring in information from the other software packages and > displaying it on the same screen > so they didn't have to switch between other programs. > > The other users LOVED the software as it made their job (phone support) > much easier (more efficient). > I rarely had to negotiate. Changes were understood and well received. > > I left the company in 2004 and went to another company for 10 years. > > That company, like this one, had many users that did not like change, even > if it made their lives easier. > > That's when I became a negotiator. ;) > > > Now, back to dealing with PK-less tables joined against excel links and > trying to figure out why there are duplicate records :) > > Sigh... > > > > > On Thu, Jun 4, 2015 at 11:14 AM, Jim Lawrence wrote: > > > I suspect when you got into the computer business, you did not think that > > being a first class negotiator was one of your most important job > > requirements. ;-) > > > > Jim > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From fuller.artful at gmail.com Thu Jun 4 15:48:37 2015 From: fuller.artful at gmail.com (Arthur Fuller) Date: Thu, 4 Jun 2015 16:48:37 -0400 Subject: [AccessD] Puzzling problem with querying In-Reply-To: <1140433025.89272288.1433440703590.JavaMail.root@shaw.ca> References: <1140433025.89272288.1433440703590.JavaMail.root@shaw.ca> Message-ID: Jim, Thanks for the suggestion, but it didn't work, using either the keystroke commands or the right-button click. O well. A. On Thu, Jun 4, 2015 at 1:58 PM, Jim Lawrence wrote: > Actually you can capture the text in most, if not all error messages, that > remain displayed on the screen. Just left-mouse-click, hold down and move > over the text as if you were capturing it, like in any document and ctrl-c > or right-mouse click...select copy. Then bring up a note window, click and > ctrl-v or right-mouse click...select paste. If you have done everything > right the text you dragged over, even though it did not highlight, should > then display. From davidmcafee at gmail.com Thu Jun 4 15:57:07 2015 From: davidmcafee at gmail.com (David McAfee) Date: Thu, 4 Jun 2015 13:57:07 -0700 Subject: [AccessD] Puzzling problem with querying In-Reply-To: References: <1140433025.89272288.1433440703590.JavaMail.root@shaw.ca> Message-ID: This happened to me before, and I can't recall what I did to correct it. have you tried a different mdb/accdb? Compact/repair? Decompile/recompile? Import the query and related tables into a new mdb/accdb just to see if it works fine there? D On Thu, Jun 4, 2015 at 1:48 PM, Arthur Fuller wrote: > Jim, > > Thanks for the suggestion, but it didn't work, using either the keystroke > commands or the right-button click. O well. > > A. > > On Thu, Jun 4, 2015 at 1:58 PM, Jim Lawrence wrote: > > > Actually you can capture the text in most, if not all error messages, > that > > remain displayed on the screen. Just left-mouse-click, hold down and move > > over the text as if you were capturing it, like in any document and > ctrl-c > > or right-mouse click...select copy. Then bring up a note window, click > and > > ctrl-v or right-mouse click...select paste. If you have done everything > > right the text you dragged over, even though it did not highlight, should > > then display. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From davidmcafee at gmail.com Thu Jun 4 16:00:30 2015 From: davidmcafee at gmail.com (David McAfee) Date: Thu, 4 Jun 2015 14:00:30 -0700 Subject: [AccessD] Puzzling problem with querying In-Reply-To: References: <1140433025.89272288.1433440703590.JavaMail.root@shaw.ca> Message-ID: also, if this is a split db, is this only occurring in the FE, not the BE? On Thu, Jun 4, 2015 at 1:57 PM, David McAfee wrote: > This happened to me before, and I can't recall what I did to correct it. > > have you tried a different mdb/accdb? > > Compact/repair? Decompile/recompile? > > Import the query and related tables into a new mdb/accdb just to see if it > works fine there? > > D > > On Thu, Jun 4, 2015 at 1:48 PM, Arthur Fuller > wrote: > >> Jim, >> >> Thanks for the suggestion, but it didn't work, using either the keystroke >> commands or the right-button click. O well. >> >> A. >> >> On Thu, Jun 4, 2015 at 1:58 PM, Jim Lawrence wrote: >> >> > Actually you can capture the text in most, if not all error messages, >> that >> > remain displayed on the screen. Just left-mouse-click, hold down and >> move >> > over the text as if you were capturing it, like in any document and >> ctrl-c >> > or right-mouse click...select copy. Then bring up a note window, click >> and >> > ctrl-v or right-mouse click...select paste. If you have done everything >> > right the text you dragged over, even though it did not highlight, >> should >> > then display. >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> > > From bensonforums at gmail.com Thu Jun 4 16:07:09 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 4 Jun 2015 17:07:09 -0400 Subject: [AccessD] Ac2013 running out of resources Message-ID: I have the following routine. Access is running out of resources after about the 60th item in the resordset (Rst). I can't understand why, since I keep updating the SQL of the same querydef, on which the (very simply) report is based, and am outputting to PDF. It happens even if I remove the insertion logic below the reporting output logic. Any experience and assistance would be very greatly appreciated. Sub DoManagerReportsWest(strStartDate As String, strEndDate As String, Optional FY) Dim DB As dao.Database Dim SQL As String Dim QDF As dao.QueryDef Dim rst As dao.Recordset Dim SQL1 As String Dim FLD As Folder Dim FSO As FileSystemObject Dim strPath As String Dim rstTest As dao.Recordset Dim SQLInsert As String Dim strReportPath As String Dim SQLDelete As String Set DB = CurrentDb Set FSO = New FileSystemObject strPath = Left(DB.Name, InStrRev(DB.Name, "\") - 1) On Error Resume Next Set FLD = FSO.GetFolder(strPath & "\Reports\" & Format(Date, "Mmm dd")) If FLD Is Nothing Then Set FLD = FSO.GetFolder(strPath & "\Reports") If FLD Is Nothing Then Set FLD = FSO.CreateFolder(strPath & "\Reports") End If On Error GoTo 0 Set FLD = Nothing Set FLD = FSO.CreateFolder(strPath & "\Reports\" & Format(Date, "Mmm dd")) End If If FLD Is Nothing Then MsgBox "Cannot output reports to disk - aborting" Exit Sub End If SQL = "SELECT DISTINCT B.ID, B.Name AS [Engagement Manager], B.[first Name] as FirstName, B.Email FROM ([User Information List] AS B INNER JOIN [PDR Tracking] AS A ON B.[ID] = A.[Tax Manager]) LEFT JOIN tblCityRegion ON B.City = tblCityRegion.City WHERE tblCityRegion.Region=""West""" Set rst = DB.OpenRecordset(SQL) If Not rst.EOF Then strPath = FLD.Path Do Set QDF = DB.QueryDefs("Deliverables by Eng Manager") SQL1 = QDF.SQL SQL1 = Left(SQL1, InStr(SQL1, "WHERE ") - 1) SQL1 = SQL1 & " WHERE [Tax Manager] = " & rst.Fields(0) & " AND [Deal Status] LIKE ""Signed*"" " SQL1 = SQL1 & " AND tblCityRegion.Region=""West""" SQL1 = SQL1 & " AND ([Sign Date] Between #" & strStartDate & "# AND #" & strEndDate & "#" If Not IsMissing(FY) Then SQL1 = SQL1 & " AND NZ([Fiscal Year],'" & CStr(FY) & "') = '" & CStr(FY) & "')" Else SQL1 = SQL1 & ")" End If SQL1 = SQL1 & " AND [PDR Tracking].[Tax Partner] Is Not Null " SQL1 = SQL1 & " ORDER BY [User Information List].City Asc, [PDR Tracking].[Tax Manager] Asc;" Set rstTest = Nothing Set rstTest = DB.OpenRecordset(SQL1) If Not rstTest.EOF Then QDF.SQL = SQL1 DB.QueryDefs.Refresh: Set QDF = Nothing strReportPath = strPath & "\" & Replace$(rst.Fields(1), "/", " ") & "_Deliverables By Manager (West) Signed " & Format(CDate(strStartDate), "yyyy_mm_dd") & " to " & Format(CDate(strEndDate), "yyyy_mm_dd") & ".pdf" On Error Resume Next Kill strReportPath On Error GoTo 0 DoCmd.OutputTo acOutputReport, "rptDeliverableManager", acFormatPDF, strReportPath SQLDelete = "Delete From tblBatchReports " SQLDelete = SQLDelete & " Where " SQLDelete = SQLDelete & " ReportName = 'Deliverables By Manager (West)'" SQLDelete = SQLDelete & " AND SignDateBegin = #" & strStartDate & "#" SQLDelete = SQLDelete & " AND SignDateEnd = #" & strEndDate & "#" SQLDelete = SQLDelete & " AND Employee = '" & rst.Fields("Engagement Manager") & "'" SQLDelete = SQLDelete & " AND Sent IS NULL" CurrentDb.Execute SQLDelete, dbFailOnError SQLInsert = "Insert Into TblBatchReports (ReportName,SignDateBegin,SignDateEnd,CreateDate,ReportPath,Employee,FirstName,EmailAddress)" SQLInsert = SQLInsert & " Values ('Deliverables By Manager (West)'," SQLInsert = SQLInsert & "#" & strStartDate & "#," SQLInsert = SQLInsert & "#" & strEndDate & "#," SQLInsert = SQLInsert & "#" & Format(Date, "m/d/yyyy") & "#," SQLInsert = SQLInsert & "'" & strReportPath & "'," SQLInsert = SQLInsert & "'" & rst.Fields("Engagement Manager") & "'," SQLInsert = SQLInsert & "'" & rst.Fields("FirstName") & "'," SQLInsert = SQLInsert & "'" & rst.Fields("Email") & "')" DB.Execute SQLInsert, dbFailOnError End If rst.MoveNext Loop Until rst.EOF End If End Sub From bensonforums at gmail.com Thu Jun 4 16:11:52 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 4 Jun 2015 17:11:52 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: Message-ID: the SQL in the base query is SELECT [User Information List].Office AS [Manager Office], [PDR Tracking].[Tax Manager], [PDR Tracking].[Project Name], [PDR Tracking].[Client Name], [PDR Tracking].[Tax Partner], IIf([Document Type]="DDR, 100 Day Plan and Structuring","Y","") AS [DDR, 100 Day Plan and Structuring], IIf([Document Type]="DDR and Structuring","Y","") AS [DDR and Structuring], IIf([Document Type]="DDR and 100-Day Plan","Y","") AS [DDR and 100-Day Plan], IIf([Document Type]="100 Day Plan and Structuring","Y","") AS [100 Day Plan and Structuring], IIf([document Type]="Due Diligence Report","Y","") AS [Due Diligence Report], IIf([Document Type]="Structuring","Y","") AS Structuring, IIf([Document Type]="100 Day Plan","Y","") AS [100 Day Plan] FROM ([PDR Tracking] INNER JOIN [User Information List] ON [PDR Tracking].[Tax Manager] = [User Information List].ID) INNER JOIN tblCityRegion ON [User Information List].City = tblCityRegion.City WHERE [Tax Manager] = 252 AND [Deal Status] LIKE "Signed*" AND tblCityRegion.Region="East" AND ([Sign Date] Between #5/31/2015# AND #10/1/2014#) AND [PDR Tracking].[Tax Partner] Is Not Null ORDER BY [User Information List].City, [PDR Tracking].[Tax Manager]; Note that I am changing the WHERE clause. Also note that the main two tables [User Information List] and [PDR Tracking] are Sharepoint Lists (linked). On Thu, Jun 4, 2015 at 5:07 PM, Bill Benson wrote: > I have the following routine. Access is running out of resources after > about the 60th item in the resordset (Rst). I can't understand why, since I > keep updating the SQL of the same querydef, on which the (very simply) > report is based, and am outputting to PDF. It happens even if I remove the > insertion logic below the reporting output logic. > > Any experience and assistance would be very greatly appreciated. > > > Sub DoManagerReportsWest(strStartDate As String, strEndDate As String, > Optional FY) > Dim DB As dao.Database > Dim SQL As String > Dim QDF As dao.QueryDef > Dim rst As dao.Recordset > Dim SQL1 As String > Dim FLD As Folder > Dim FSO As FileSystemObject > Dim strPath As String > Dim rstTest As dao.Recordset > Dim SQLInsert As String > Dim strReportPath As String > Dim SQLDelete As String > Set DB = CurrentDb > Set FSO = New FileSystemObject > strPath = Left(DB.Name, InStrRev(DB.Name, "\") - 1) > On Error Resume Next > Set FLD = FSO.GetFolder(strPath & "\Reports\" & Format(Date, "Mmm dd")) > If FLD Is Nothing Then > Set FLD = FSO.GetFolder(strPath & "\Reports") > If FLD Is Nothing Then > Set FLD = FSO.CreateFolder(strPath & "\Reports") > End If > On Error GoTo 0 > Set FLD = Nothing > Set FLD = FSO.CreateFolder(strPath & "\Reports\" & Format(Date, "Mmm > dd")) > End If > If FLD Is Nothing Then > MsgBox "Cannot output reports to disk - aborting" > Exit Sub > End If > SQL = "SELECT DISTINCT B.ID, B.Name AS [Engagement Manager], B.[first > Name] as FirstName, B.Email FROM ([User Information List] AS B INNER JOIN > [PDR Tracking] AS A ON B.[ID] = A.[Tax Manager]) LEFT JOIN tblCityRegion ON > B.City = tblCityRegion.City WHERE tblCityRegion.Region=""West""" > Set rst = DB.OpenRecordset(SQL) > If Not rst.EOF Then > strPath = FLD.Path > > Do > Set QDF = DB.QueryDefs("Deliverables by Eng Manager") > SQL1 = QDF.SQL > SQL1 = Left(SQL1, InStr(SQL1, "WHERE ") - 1) > SQL1 = SQL1 & " WHERE [Tax Manager] = " & rst.Fields(0) & " AND > [Deal Status] LIKE ""Signed*"" " > SQL1 = SQL1 & " AND tblCityRegion.Region=""West""" > SQL1 = SQL1 & " AND ([Sign Date] Between #" & strStartDate & "# > AND #" & strEndDate & "#" > If Not IsMissing(FY) Then > SQL1 = SQL1 & " AND NZ([Fiscal Year],'" & CStr(FY) & "') = '" > & CStr(FY) & "')" > Else > SQL1 = SQL1 & ")" > End If > SQL1 = SQL1 & " AND [PDR Tracking].[Tax Partner] Is Not Null " > SQL1 = SQL1 & " ORDER BY [User Information List].City Asc, [PDR > Tracking].[Tax Manager] Asc;" > Set rstTest = Nothing > Set rstTest = DB.OpenRecordset(SQL1) > If Not rstTest.EOF Then > QDF.SQL = SQL1 > DB.QueryDefs.Refresh: Set QDF = Nothing > strReportPath = strPath & "\" & Replace$(rst.Fields(1), "/", " > ") & "_Deliverables By Manager (West) Signed " & > Format(CDate(strStartDate), "yyyy_mm_dd") & " to " & > Format(CDate(strEndDate), "yyyy_mm_dd") & ".pdf" > > On Error Resume Next > Kill strReportPath > On Error GoTo 0 > DoCmd.OutputTo acOutputReport, "rptDeliverableManager", > acFormatPDF, strReportPath > > SQLDelete = "Delete From tblBatchReports " > SQLDelete = SQLDelete & " Where " > SQLDelete = SQLDelete & " ReportName = 'Deliverables By > Manager (West)'" > SQLDelete = SQLDelete & " AND SignDateBegin = #" & > strStartDate & "#" > SQLDelete = SQLDelete & " AND SignDateEnd = #" & strEndDate & > "#" > SQLDelete = SQLDelete & " AND Employee = '" & > rst.Fields("Engagement Manager") & "'" > SQLDelete = SQLDelete & " AND Sent IS NULL" > CurrentDb.Execute SQLDelete, dbFailOnError > > SQLInsert = "Insert Into TblBatchReports > (ReportName,SignDateBegin,SignDateEnd,CreateDate,ReportPath,Employee,FirstName,EmailAddress)" > SQLInsert = SQLInsert & " Values ('Deliverables By Manager > (West)'," > SQLInsert = SQLInsert & "#" & strStartDate & "#," > SQLInsert = SQLInsert & "#" & strEndDate & "#," > SQLInsert = SQLInsert & "#" & Format(Date, "m/d/yyyy") & "#," > SQLInsert = SQLInsert & "'" & strReportPath & "'," > SQLInsert = SQLInsert & "'" & rst.Fields("Engagement Manager") > & "'," > SQLInsert = SQLInsert & "'" & rst.Fields("FirstName") & "'," > SQLInsert = SQLInsert & "'" & rst.Fields("Email") & "')" > DB.Execute SQLInsert, dbFailOnError > End If > rst.MoveNext > Loop Until rst.EOF > End If > End Sub > From davidmcafee at gmail.com Thu Jun 4 16:41:37 2015 From: davidmcafee at gmail.com (David McAfee) Date: Thu, 4 Jun 2015 14:41:37 -0700 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: Message-ID: Is there a reason that you have to do everything in VBA? Can you have one or two queries and reports and decide which one to run as you are looping through the recordset? This is how I ended up doing mine (passing the where clause as the report parameter): Dim Path As String, DateString As String, FileName As String, ShowPdf As Boolean Dim intRowCount As Integer reportName = "rptLossOfMediCalCoverage" DateString = Format(Date, "YYMMDD") Path = "E:\Eligibility\Reports\" & DateString & "\" 'Check if directory exists, if not, make it If Dir(Path, vbDirectory) = "" Then MkDir Path 'Open record set of director names Dim db As Database Dim rs As Recordset Set db = CurrentDb Set rs = db.OpenRecordset("select Director from dbo_vwDirectors") If rs.BOF And rs.EOF Then 'This really should not happen MsgBox "No directors were returned from dbo_vwDirectors" rs.Close Set rs = Nothing Exit Sub Else rs.MoveLast rs.MoveFirst If rs.RecordCount >= 1 Then '1 or More records found. For intRowCount = 1 To (rs.RecordCount + 1) FileName = "rptLossOfMediCal_" & DateString & "_" & Replace(rs![director], " ", "_") & ".pdf" DoCmd.OpenReport reportName, acViewPreview, , "Director = '" & rs![director] & "'" 'Can you put your where clause in a string and use it here? 'Or depending on the situation, set report name to a different report? ShowPdf = False 'DoCmd.OutputTo acOutputReport, reportName, acFormatPDF, (Path & FileName) DoCmd.OutputTo acOutputReport, reportName, "PDFFormat(*.pdf)", (Path & FileName), ShowPdf, "", 0 rs.MoveNext intRowCount = intRowCount + 1 DoCmd.Close acReport, reportName Next intRowCount Else 'Record Count = 0, This shouldnt happen, but trap just in case MsgBox "No records were returned from dbo_vwDirectors" End If rs.Close Set rs = Nothing db.Close Set db = Nothing End If From fuller.artful at gmail.com Thu Jun 4 17:35:01 2015 From: fuller.artful at gmail.com (Arthur Fuller) Date: Thu, 4 Jun 2015 18:35:01 -0400 Subject: [AccessD] Puzzling problem with querying In-Reply-To: References: <1140433025.89272288.1433440703590.JavaMail.root@shaw.ca> Message-ID: Thanks, David. I'll give your suggestions a go and report my results. Arthur On Thu, Jun 4, 2015 at 5:00 PM, David McAfee wrote: > also, if this is a split db, is this only occurring in the FE, not the BE? > > On Thu, Jun 4, 2015 at 1:57 PM, David McAfee > wrote: > > > This happened to me before, and I can't recall what I did to correct it. > > > > have you tried a different mdb/accdb? > > > > Compact/repair? Decompile/recompile? > > > > Import the query and related tables into a new mdb/accdb just to see if > it > > works fine there? > > > > D > > > From bensonforums at gmail.com Thu Jun 4 19:04:05 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 4 Jun 2015 20:04:05 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: Message-ID: If I don't do it all in VBA, then the user will be stuck sending each report individually, no? Why do you open the report first, what is that accomplishing? I don't see any pause occurring in your code, but what happens when you are opening the report in preview view? I don't understand what you are saying regarding changing the WHERE clause to a string, is that a way of limiting what the report shows? Isn't that what I am accomplishing by editing the query sql? Would I be better off changing the recordsource for the report, by creating a new query each time rather than the same query? I will try opening the report as you do, then printing it, and then closing it - so long as this doesn't interrupt the process. On Thu, Jun 4, 2015 at 5:41 PM, David McAfee wrote: > Is there a reason that you have to do everything in VBA? > Can you have one or two queries and reports and decide which one to run as > you are looping through the recordset? > > This is how I ended up doing mine (passing the where clause as the report > parameter): > > Dim Path As String, DateString As String, FileName As String, ShowPdf As > Boolean > Dim intRowCount As Integer > reportName = "rptLossOfMediCalCoverage" > DateString = Format(Date, "YYMMDD") > Path = "E:\Eligibility\Reports\" & DateString & "\" > > 'Check if directory exists, if not, make it > If Dir(Path, vbDirectory) = "" Then MkDir Path > > 'Open record set of director names > Dim db As Database > Dim rs As Recordset > Set db = CurrentDb > Set rs = db.OpenRecordset("select Director from dbo_vwDirectors") > If rs.BOF And rs.EOF Then > 'This really should not happen > MsgBox "No directors were returned from dbo_vwDirectors" > rs.Close > Set rs = Nothing > Exit Sub > Else > rs.MoveLast > rs.MoveFirst > If rs.RecordCount >= 1 Then '1 or More records found. > For intRowCount = 1 To (rs.RecordCount + 1) > FileName = "rptLossOfMediCal_" & DateString & "_" & > Replace(rs![director], " ", "_") & ".pdf" > DoCmd.OpenReport reportName, acViewPreview, , "Director = '" & > rs![director] & "'" 'Can you put your where clause in a string and use it > here? > 'Or depending on the situation, set report name to a different > report? > ShowPdf = False > 'DoCmd.OutputTo acOutputReport, reportName, acFormatPDF, (Path & > FileName) > DoCmd.OutputTo acOutputReport, reportName, "PDFFormat(*.pdf)", > (Path & FileName), ShowPdf, "", 0 > > rs.MoveNext > intRowCount = intRowCount + 1 > DoCmd.Close acReport, reportName > Next intRowCount > > Else 'Record Count = 0, This shouldnt happen, but trap just in > case > MsgBox "No records were returned from dbo_vwDirectors" > End If > rs.Close > Set rs = Nothing > db.Close > Set db = Nothing > End If > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From marksimms at verizon.net Thu Jun 4 19:34:17 2015 From: marksimms at verizon.net (Mark Simms) Date: Thu, 04 Jun 2015 20:34:17 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: Message-ID: <06e301d09f27$5bd34de0$1379e9a0$@net> This is endemic to AC2013. It's all-messed-up. I am constantly getting hung queries as well as "Resources Exceeded" messages. It's really a P.O.C. Almost unusable as a contrast to a darn good 2010 release. Also: I just got an Office 2013 update installed and there was no improvement. From stuart at lexacorp.com.pg Thu Jun 4 20:43:24 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Fri, 05 Jun 2015 11:43:24 +1000 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <06e301d09f27$5bd34de0$1379e9a0$@net> References: , <06e301d09f27$5bd34de0$1379e9a0$@net> Message-ID: <5570FEBC.31271.4134939E@stuart.lexacorp.com.pg> Typical MS. Every second version is OK. v 2 OK 95 cr*p 97 OK 2000 cr*p 2003 OK 2007 cr*p 2010 OK 2013 cr*p 2016 ? :) On 4 Jun 2015 at 20:34, Mark Simms wrote: > This is endemic to AC2013. It's all-messed-up. > I am constantly getting hung queries as well as "Resources Exceeded" > messages. It's really a P.O.C. Almost unusable as a contrast to a darn > good 2010 release. > > Also: I just got an Office 2013 update installed and there was no > improvement. > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Thu Jun 4 21:10:24 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 4 Jun 2015 22:10:24 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <5570FEBC.31271.4134939E@stuart.lexacorp.com.pg> References: <06e301d09f27$5bd34de0$1379e9a0$@net> <5570FEBC.31271.4134939E@stuart.lexacorp.com.pg> Message-ID: Guys, I sure join in the lament but.... surely there HAS to be a way to not run out of resources. Even if I have to stash the darned data in a remote database (also linked to SharePoint obvously) that I open long enough to run a report in via a auto exec macro and then shut it down... surely there has to be a way to do this? I hate abject failure. Would it matter if I ran the reports against a temp table (populated with a consecutive loop of make table queries)? There are seldom more than 30 records per report, as this routine is breaking out project list report by partner - or manager, itdepends on which is called - and no partner has more than 30 projects that is sure. I wanted to test the impact of opening the reports in acPreview as David suggested... but dammit, the database stopped being able to connect to Sharepoint url about 8PM. Maybe they brought it down for maintenance. So I couldn't test it. I don't mind a kluge at this point. Barring that, asking the user to shut down the database to run all remaining reports (in picking up at whatever point the record set left off by comparing to records in a log table is about all I can come up with here... not likely to endear me with my users. Help......... On Jun 4, 2015 9:44 PM, "Stuart McLachlan" wrote: > Typical MS. Every second version is OK. > > v 2 OK > 95 cr*p > 97 OK > 2000 cr*p > 2003 OK > 2007 cr*p > 2010 OK > 2013 cr*p > 2016 ? > > :) > > > On 4 Jun 2015 at 20:34, Mark Simms wrote: > > > This is endemic to AC2013. It's all-messed-up. > > I am constantly getting hung queries as well as "Resources Exceeded" > > messages. It's really a P.O.C. Almost unusable as a contrast to a darn > > good 2010 release. > > > > Also: I just got an Office 2013 update installed and there was no > > improvement. > > > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From darryl at whittleconsulting.com.au Thu Jun 4 22:02:46 2015 From: darryl at whittleconsulting.com.au (Darryl Collins) Date: Fri, 5 Jun 2015 03:02:46 +0000 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <06e301d09f27$5bd34de0$1379e9a0$@net> <5570FEBC.31271.4134939E@stuart.lexacorp.com.pg> Message-ID: Heh... There is Bill. It is called 'SQL Server Express'. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Friday, 5 June 2015 12:10 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources Guys, I sure join in the lament but.... surely there HAS to be a way to not run out of resources. Even if I have to stash the darned data in a remote database (also linked to SharePoint obvously) that I open long enough to run a report in via a auto exec macro and then shut it down... surely there has to be a way to do this? I hate abject failure. Would it matter if I ran the reports against a temp table (populated with a consecutive loop of make table queries)? There are seldom more than 30 records per report, as this routine is breaking out project list report by partner - or manager, itdepends on which is called - and no partner has more than 30 projects that is sure. I wanted to test the impact of opening the reports in acPreview as David suggested... but dammit, the database stopped being able to connect to Sharepoint url about 8PM. Maybe they brought it down for maintenance. So I couldn't test it. I don't mind a kluge at this point. Barring that, asking the user to shut down the database to run all remaining reports (in picking up at whatever point the record set left off by comparing to records in a log table is about all I can come up with here... not likely to endear me with my users. Help......... On Jun 4, 2015 9:44 PM, "Stuart McLachlan" wrote: > Typical MS. Every second version is OK. > > v 2 OK > 95 cr*p > 97 OK > 2000 cr*p > 2003 OK > 2007 cr*p > 2010 OK > 2013 cr*p > 2016 ? > > :) > > > On 4 Jun 2015 at 20:34, Mark Simms wrote: > > > This is endemic to AC2013. It's all-messed-up. > > I am constantly getting hung queries as well as "Resources Exceeded" > > messages. It's really a P.O.C. Almost unusable as a contrast to a > > darn good 2010 release. > > > > Also: I just got an Office 2013 update installed and there was no > > improvement. > > > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Fri Jun 5 00:44:14 2015 From: bensonforums at gmail.com (Bill Benson) Date: Fri, 5 Jun 2015 01:44:14 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <06e301d09f27$5bd34de0$1379e9a0$@net> <5570FEBC.31271.4134939E@stuart.lexacorp.com.pg> Message-ID: What is causing resources to max out. The reports are not large, the queries not complex. Is it SharePoint? Output to PDF? What could Ac2013 possibly be straining at here? On Jun 4, 2015 11:04 PM, "Darryl Collins" wrote: > Heh... There is Bill. It is called 'SQL Server Express'. > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Friday, 5 June 2015 12:10 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 running out of resources > > Guys, I sure join in the lament but.... surely there HAS to be a way to > not run out of resources. Even if I have to stash the darned data in a > remote database (also linked to SharePoint obvously) that I open long > enough to run a report in via a auto exec macro and then shut it down... > surely there has to be a way to do this? I hate abject failure. > > Would it matter if I ran the reports against a temp table (populated with > a consecutive loop of make table queries)? There are seldom more than 30 > records per report, as this routine is breaking out project list report by > partner - or manager, itdepends on which is called - and no partner has > more than 30 projects that is sure. > > I wanted to test the impact of opening the reports in acPreview as David > suggested... but dammit, the database stopped being able to connect to > Sharepoint url about 8PM. Maybe they brought it down for maintenance. So I > couldn't test it. > > I don't mind a kluge at this point. Barring that, asking the user to shut > down the database to run all remaining reports (in picking up at whatever > point the record set left off by comparing to records in a log table is > about all I can come up with here... not likely to endear me with my users. > > Help......... > On Jun 4, 2015 9:44 PM, "Stuart McLachlan" wrote: > > > Typical MS. Every second version is OK. > > > > v 2 OK > > 95 cr*p > > 97 OK > > 2000 cr*p > > 2003 OK > > 2007 cr*p > > 2010 OK > > 2013 cr*p > > 2016 ? > > > > :) > > > > > > On 4 Jun 2015 at 20:34, Mark Simms wrote: > > > > > This is endemic to AC2013. It's all-messed-up. > > > I am constantly getting hung queries as well as "Resources Exceeded" > > > messages. It's really a P.O.C. Almost unusable as a contrast to a > > > darn good 2010 release. > > > > > > Also: I just got an Office 2013 update installed and there was no > > > improvement. > > > > > > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From darryl at whittleconsulting.com.au Fri Jun 5 00:59:59 2015 From: darryl at whittleconsulting.com.au (Darryl Collins) Date: Fri, 5 Jun 2015 05:59:59 +0000 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <06e301d09f27$5bd34de0$1379e9a0$@net> <5570FEBC.31271.4134939E@stuart.lexacorp.com.pg> Message-ID: In my experience Access is like a fat old guy going for a Jog. It tries hard and sometime can surprise you with bursts of speed, endurance and agility, but other times it will get puffed out over nothing, give up and stop. The most simple work-around I found was not to use mega queries ( or even simple queries with multiple joins seem to be a culprit here), rather building the final data set required via a series of helper queries (or even tables). This approach would nearly always produce much better performance and less of a processing struggle for Access. Also look at what you have indexed as well - that can make a big difference. Keep in mind Access is poor at cleaning up after itself. I have had simple queries push it over the 2GB limit whilst processing and it just sh!ts itself and stops. Bloody stupid, but that is how it is. As the datasets we are working with are getting larger and more complex, we are moving more and more of the grunt processing into SQL server - and only use Access for "the last mile" of processing when the data is usually significantly compacted. SQL Server rarely gives up and will run until the gig is done. Anyway... Good luck. I can relate to your frustration and annoyance. Darryl. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Friday, 5 June 2015 3:44 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources What is causing resources to max out. The reports are not large, the queries not complex. Is it SharePoint? Output to PDF? What could Ac2013 possibly be straining at here? On Jun 4, 2015 11:04 PM, "Darryl Collins" wrote: > Heh... There is Bill. It is called 'SQL Server Express'. > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of Bill Benson > Sent: Friday, 5 June 2015 12:10 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 running out of resources > > Guys, I sure join in the lament but.... surely there HAS to be a way > to not run out of resources. Even if I have to stash the darned data > in a remote database (also linked to SharePoint obvously) that I open > long enough to run a report in via a auto exec macro and then shut it down... > surely there has to be a way to do this? I hate abject failure. > > Would it matter if I ran the reports against a temp table (populated > with a consecutive loop of make table queries)? There are seldom more > than 30 records per report, as this routine is breaking out project > list report by partner - or manager, itdepends on which is called - > and no partner has more than 30 projects that is sure. > > I wanted to test the impact of opening the reports in acPreview as > David suggested... but dammit, the database stopped being able to > connect to Sharepoint url about 8PM. Maybe they brought it down for > maintenance. So I couldn't test it. > > I don't mind a kluge at this point. Barring that, asking the user to > shut down the database to run all remaining reports (in picking up at > whatever point the record set left off by comparing to records in a > log table is about all I can come up with here... not likely to endear me with my users. > > Help......... > On Jun 4, 2015 9:44 PM, "Stuart McLachlan" wrote: > > > Typical MS. Every second version is OK. > > > > v 2 OK > > 95 cr*p > > 97 OK > > 2000 cr*p > > 2003 OK > > 2007 cr*p > > 2010 OK > > 2013 cr*p > > 2016 ? > > > > :) > > > > > > On 4 Jun 2015 at 20:34, Mark Simms wrote: > > > > > This is endemic to AC2013. It's all-messed-up. > > > I am constantly getting hung queries as well as "Resources Exceeded" > > > messages. It's really a P.O.C. Almost unusable as a contrast to a > > > darn good 2010 release. > > > > > > Also: I just got an Office 2013 update installed and there was no > > > improvement. > > > > > > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Fri Jun 5 02:21:11 2015 From: bensonforums at gmail.com (Bill Benson) Date: Fri, 5 Jun 2015 03:21:11 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <06e301d09f27$5bd34de0$1379e9a0$@net> <5570FEBC.31271.4134939E@stuart.lexacorp.com.pg> Message-ID: The query runs over 60 times in a loop that outputs this same report. I don't see how the complexity of the query could have anything to do with consuming resources On Jun 5, 2015 2:01 AM, "Darryl Collins" wrote: > In my experience Access is like a fat old guy going for a Jog. It tries > hard and sometime can surprise you with bursts of speed, endurance and > agility, but other times it will get puffed out over nothing, give up and > stop. > > The most simple work-around I found was not to use mega queries ( or even > simple queries with multiple joins seem to be a culprit here), rather > building the final data set required via a series of helper queries (or > even tables). This approach would nearly always produce much better > performance and less of a processing struggle for Access. Also look at > what you have indexed as well - that can make a big difference. > > Keep in mind Access is poor at cleaning up after itself. I have had > simple queries push it over the 2GB limit whilst processing and it just > sh!ts itself and stops. Bloody stupid, but that is how it is. > > As the datasets we are working with are getting larger and more complex, > we are moving more and more of the grunt processing into SQL server - and > only use Access for "the last mile" of processing when the data is usually > significantly compacted. SQL Server rarely gives up and will run until the > gig is done. > > Anyway... Good luck. I can relate to your frustration and annoyance. > > Darryl. > > > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Friday, 5 June 2015 3:44 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 running out of resources > > What is causing resources to max out. The reports are not large, the > queries not complex. Is it SharePoint? Output to PDF? What could Ac2013 > possibly be straining at here? > On Jun 4, 2015 11:04 PM, "Darryl Collins" > > wrote: > > > Heh... There is Bill. It is called 'SQL Server Express'. > > > > -----Original Message----- > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > > Of Bill Benson > > Sent: Friday, 5 June 2015 12:10 PM > > To: Access Developers discussion and problem solving > > Subject: Re: [AccessD] Ac2013 running out of resources > > > > Guys, I sure join in the lament but.... surely there HAS to be a way > > to not run out of resources. Even if I have to stash the darned data > > in a remote database (also linked to SharePoint obvously) that I open > > long enough to run a report in via a auto exec macro and then shut it > down... > > surely there has to be a way to do this? I hate abject failure. > > > > Would it matter if I ran the reports against a temp table (populated > > with a consecutive loop of make table queries)? There are seldom more > > than 30 records per report, as this routine is breaking out project > > list report by partner - or manager, itdepends on which is called - > > and no partner has more than 30 projects that is sure. > > > > I wanted to test the impact of opening the reports in acPreview as > > David suggested... but dammit, the database stopped being able to > > connect to Sharepoint url about 8PM. Maybe they brought it down for > > maintenance. So I couldn't test it. > > > > I don't mind a kluge at this point. Barring that, asking the user to > > shut down the database to run all remaining reports (in picking up at > > whatever point the record set left off by comparing to records in a > > log table is about all I can come up with here... not likely to endear > me with my users. > > > > Help......... > > On Jun 4, 2015 9:44 PM, "Stuart McLachlan" > wrote: > > > > > Typical MS. Every second version is OK. > > > > > > v 2 OK > > > 95 cr*p > > > 97 OK > > > 2000 cr*p > > > 2003 OK > > > 2007 cr*p > > > 2010 OK > > > 2013 cr*p > > > 2016 ? > > > > > > :) > > > > > > > > > On 4 Jun 2015 at 20:34, Mark Simms wrote: > > > > > > > This is endemic to AC2013. It's all-messed-up. > > > > I am constantly getting hung queries as well as "Resources Exceeded" > > > > messages. It's really a P.O.C. Almost unusable as a contrast to a > > > > darn good 2010 release. > > > > > > > > Also: I just got an Office 2013 update installed and there was no > > > > improvement. > > > > > > > > > > > > > > > > -- > > > > AccessD mailing list > > > > AccessD at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > Website: http://www.databaseadvisors.com > > > > > > > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From jimdettman at verizon.net Fri Jun 5 07:48:05 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Fri, 05 Jun 2015 08:48:05 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: Message-ID: <03E8811F981D44B6B627998DAA4FB615@XPS> Bill, See if the below runs any better. Jim. Sub DoManagerReportsWest(strStartDate As String, strEndDate As String, Optional prmFiscalYear) Dim CurDB As dao.Database Dim objFSOFolder As Folder Dim objFSO As FileSystemObject Dim strPath As String Dim strReportPath As String Dim qrydef As dao.QueryDef Dim rst As dao.Recordset Dim rstTest As dao.Recordset Dim strSQL As String Dim strSQLqryDef As String Dim steSQLInsert As String Dim strSQLDelete As String On Error GoTo DoManagerReportsWest_Error ' Make sure we have a report folder. If not, try and create it. Set CurDB = CurrentDb Set objFSO = New FileSystemObject strPath = left(CurDB.Name, InStrRev(CurDB.Name, "\") - 1) On Error Resume Next Set objFSOFolder = objFSO.GetFolder(strPath & "\Reports\" & Format(Date, "Mmm dd")) If objFSOFolder Is Nothing Then Set objFSOFolder = objFSO.GetFolder(strPath & "\Reports") If objFSOFolder Is Nothing Then Set objFSOFolder = objFSO.CreateFolder(strPath & "\Reports") End If On Error GoTo DoManagerReportsWest_Error Set objFSOFolder = objFSO.CreateFolder(strPath & "\Reports\" & Format(Date, "Mmmdd ")) End If ' If we don't have a folder, no sense running the reports. If objFSOFolder Is Nothing Then MsgBox "Cannot output reports to disk - aborting" Else strPath = objFSOFolder.Path Set objFSOFolder = Nothing ' Get the reports to run. strSQL = "SELECT DISTINCT B.ID, B.Name AS [Engagement Manager], B.[first Name] as FirstName, B.Email" strSQL = strSQL & " FROM ([User Information List] AS B INNER JOIN [PDRTracking] AS A ON B.[ID] = A.[Tax Manager])" strSQL = strSQL & " LEFT JOIN tblCityRegion ON B.City = tblCityRegion.City WHERE tblCityRegion.Region='West'" Set rst = CurDB.OpenRecordset(strSQL) Do Until rst.EOF ' Generate the SQL required for the report. Set qrydef = CurDB.QueryDefs("Deliverables by Eng Manager") strSQLqryDef = qrydef.SQL strSQLqryDef = left(strSQLqryDef, InStr(strSQLqryDef, "WHERE ") - 1) strSQLqryDef = strSQLqryDef & " WHERE [Tax Manager] = " & rst.Fields(0).Value & " AND [Deal Status] LIKE 'Signed*' " strSQLqryDef = strSQLqryDef & " AND tblCityRegion.Region='West'" strSQLqryDef = strSQLqryDef & " AND ([Sign Date] Between #" & strStartDate & "# AND #" & strEndDate & "#" If Not IsMissing(prmFiscalYear) Then strSQLqryDef = strSQLqryDef & " AND NZ([Fiscal Year],'" & CStr(prmFiscalYear) & "') = '" & CStr(prmFiscalYear) & "')" Else strSQLqryDef = strSQLqryDef & ")" End If strSQLqryDef = strSQLqryDef & " AND [PDR Tracking].[Tax Partner] Is Not Null " strSQLqryDef = strSQLqryDef & " ORDER BY [User Information List].City Asc, [PDRTracking].[Tax Manager] Asc;" qrydef.SQL = strSQLqryDef qrydef.Close Set qrydef = Nothing Set rstTest = CurDB.OpenRecordset(strSQLqryDef) If Not rstTest.EOF Then strReportPath = strPath & "\" & Replace$(rst.Fields(1), "/", " ") & "_Deliverables By Manager (West) Signed " & Format(CDate(strStartDate), "yyyy_mm_dd") & " to " & Format(CDate(strEndDate), "yyyy_mm_dd") & ".pdf" On Error Resume Next Kill strReportPath On Error GoTo DoManagerReportsWest_Error DoCmd.OutputTo acOutputReport, "rptDeliverableManager", acFormatPDF, strReportPath strSQLDelete = "Delete From tblBatchReports " strSQLDelete = strSQLDelete & " WHERE " strSQLDelete = strSQLDelete & " ReportName = 'Deliverables By Manager (West)'" strSQLDelete = strSQLDelete & " AND SignDateBegin = #" & strStartDate & "#" strSQLDelete = strSQLDelete & " AND SignDateEnd = #" & strEndDate & "#" strSQLDelete = strSQLDelete & " AND Employee = '" & rst.Fields("Engagement Manager") & "'" strSQLDelete = strSQLDelete & " AND Sent IS NULL" CurDB.Execute strSQLDelete, dbFailOnError steSQLInsert = "Insert Into TblBatchReports(ReportName,SignDateBegin,SignDateEnd,CreateDate,ReportPath,E mployee,FirstName,EmailAddress)" steSQLInsert = steSQLInsert & " VALUES ('Deliverables By Manager (West)'," steSQLInsert = steSQLInsert & "#" & strStartDate & "#," steSQLInsert = steSQLInsert & "#" & strEndDate & "#," steSQLInsert = steSQLInsert & "#" & Format(Date, "m/d/yyyy") & "#," steSQLInsert = steSQLInsert & "'" & strReportPath & "'," steSQLInsert = steSQLInsert & "'" & rst.Fields("Engagement Manager") & "'," steSQLInsert = steSQLInsert & "'" & rst.Fields("FirstName") & "'," steSQLInsert = steSQLInsert & "'" & rst.Fields("Email") & "')" CurDB.Execute steSQLInsert, dbFailOnError End If rstTest.Close Set rstTest = Nothing rst.MoveNext Loop End If DoManagerReportsWest_Exit: On Error Resume Next rstTest.Close Set rstTest = Nothing qrydef.Close Set qrydef = Nothing rst.Close Set rst = Nothing Exit Sub DoManagerReportsWest_Error: MsgBox "Unexpected Error: " & vb.Err Resume DoManagerReportsWest_Exit End Sub -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Thursday, June 04, 2015 05:07 PM To: Access Developers discussion and problem solving Subject: [AccessD] Ac2013 running out of resources I have the following routine. Access is running out of resources after about the 60th item in the resordset (Rst). I can't understand why, since I keep updating the SQL of the same querydef, on which the (very simply) report is based, and am outputting to PDF. It happens even if I remove the insertion logic below the reporting output logic. Any experience and assistance would be very greatly appreciated. <> -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Fri Jun 5 08:14:54 2015 From: bensonforums at gmail.com (Bill Benson) Date: Fri, 5 Jun 2015 09:14:54 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <03E8811F981D44B6B627998DAA4FB615@XPS> References: <03E8811F981D44B6B627998DAA4FB615@XPS> Message-ID: Update: After changing the report to run against a temporary table, instead of a query, I got up to 66 reports before Access ran out of resources. I am sure it has nothing to do with the query. I suspect it has something to do with Access ?hanging on? to its memory of what it has outputted to PDF, rather than relinquishing whatever memory it required to do so. I have yet to try Jim's changes, I am still trying to work out what the differences are in the code. The problem, Jim, is that I have actually four (4) of these different reports, the code slightly different for each. By Partner - West By Partner - East By Manager - West By Manager - East So whatever you've done to this one I would have to make the same in the other. Before I spend time trying to implement these changes could you tell me what you have changed and why? Not sure what is a substantial change and what is just extras, like error handling. From jimdettman at verizon.net Fri Jun 5 08:35:09 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Fri, 05 Jun 2015 09:35:09 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <03E8811F981D44B6B627998DAA4FB615@XPS> Message-ID: <5957ADD01ADD4D1B9B1F009393B31FCE@XPS> Most notably: 1. Turned error handling on. 2. Used .Close on objects where appropriate. Setting objects to nothing alone does not do the job, especially with record sets. You must both .Close and set to nothing, otherwise you can easily have a resource leak. 3. I also rearranged where you were doing some things. i.e. a Set = nothing before a Set. As a general rule, I cleanup as soon as I'm done with something, not when I go to do something else. You also used multi-statement lines, which personally I've never trusted. No hard reason for that. The formatting doesn't bother me...I used to work with Wang Mini's and later NPL, and just about everything was multi-statement lines. But in VBA I've always found it best to keep things simple. 4. Changed the CurrentDB().Execute to CurDb.Execute so your not creating a new db object on each of the executes. You had it that way on one, but not on the other. 5. Removed the refresh of the QueryDefs. This is an expensive process and only needed if your creating a new querydef on the fly. Since were updating an existing one, there's no need for it or the over head. Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Friday, June 05, 2015 09:15 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources Update: After changing the report to run against a temporary table, instead of a query, I got up to 66 reports before Access ran out of resources. I am sure it has nothing to do with the query. I suspect it has something to do with Access "hanging on" to its memory of what it has outputted to PDF, rather than relinquishing whatever memory it required to do so. I have yet to try Jim's changes, I am still trying to work out what the differences are in the code. The problem, Jim, is that I have actually four (4) of these different reports, the code slightly different for each. By Partner - West By Partner - East By Manager - West By Manager - East So whatever you've done to this one I would have to make the same in the other. Before I spend time trying to implement these changes could you tell me what you have changed and why? Not sure what is a substantial change and what is just extras, like error handling. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Fri Jun 5 09:32:34 2015 From: bensonforums at gmail.com (Bill Benson) Date: Fri, 5 Jun 2015 10:32:34 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <5957ADD01ADD4D1B9B1F009393B31FCE@XPS> References: <03E8811F981D44B6B627998DAA4FB615@XPS> <5957ADD01ADD4D1B9B1F009393B31FCE@XPS> Message-ID: Changed all code as you suggested, in all procedures. While debugging other things along the way, I found myself re-initiating routines at various points, and found the resources issue to be an accumulative thing. This is to say, if I had an error running one report due to a syntax issue, and I reset VBA, then ran again and ran into another debug error (still not out of resources) - stopped VBA and fixed - then finally ran again with no errors ... I encountered out of resources error much earlier in the final running than I had when opening the database fresh and running all routines. I saw no reason to close a QDF which was not Opened, but I went with your code anyway. Personally I hate error handline because it doesn't show the line of code where the failure occurs. In any case, same problem occurred - out of resources. There are schools of thought which say to leave out error handling and let the code fail where it fails, allowing the developer to resolve as they see fit in future editions. Anyway, I left your error handling in but still ran out of resources, as I said. I do not know what you meant by my use of multistatement lines. So I am back to where I was, for all both our efforts - no closer to a solution, and as I have no hair left to pull out, I have started pulling the caps off my teeth. Grrrrrrrrrrrr I really, really think this has to do with outputting to PDF. That strikes me as something that could be a RAM intensive task, since it has to run a report, holding both the query results and the formatted report in memory, before executing a specifically-formatted file save. If somehow Access keeps all that in memory in between each outputting and doesn't relinquish the resources, I could see this as a potential source for wear and tear - I just don't know what to do about it. On Fri, Jun 5, 2015 at 9:35 AM, Jim Dettman wrote: > > Most notably: > > 1. Turned error handling on. > > 2. Used .Close on objects where appropriate. Setting objects to nothing > alone does not do the job, especially with record sets. You must both > .Close and set to nothing, otherwise you can easily have a resource leak. > > 3. I also rearranged where you were doing some things. i.e. a Set = > nothing > before a Set. As a general rule, I cleanup as soon as I'm done with > something, not when I go to do something else. > > You also used multi-statement lines, which personally I've never trusted. > No hard reason for that. The formatting doesn't bother me...I used to work > with Wang Mini's and later NPL, and just about everything was > multi-statement lines. But in VBA I've always found it best to keep things > simple. > > 4. Changed the CurrentDB().Execute to CurDb.Execute so your not creating a > new db object on each of the executes. You had it that way on one, but > not > on the other. > > 5. Removed the refresh of the QueryDefs. This is an expensive process and > only needed if your creating a new querydef on the fly. Since were > updating > an existing one, there's no need for it or the over head. > > Jim. > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Friday, June 05, 2015 09:15 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 running out of resources > > Update: After changing the report to run against a temporary table, instead > of a query, I got up to 66 reports before Access ran out of resources. I am > sure it has nothing to do with the query. I suspect it has something to do > with Access "hanging on" to its memory of what it has outputted to PDF, > rather than relinquishing whatever memory it required to do so. I have yet > to try Jim's changes, I am still trying to work out what the differences > are in the code. The problem, Jim, is that I have actually four (4) of > these different reports, the code slightly different for each. > By Partner - West > By Partner - East > By Manager - West > By Manager - East > So whatever you've done to this one I would have to make the same in the > other. Before I spend time trying to implement these changes could you tell > me what you have changed and why? Not sure what is a substantial change and > what is just extras, like error handling. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Fri Jun 5 09:46:05 2015 From: bensonforums at gmail.com (Bill Benson) Date: Fri, 5 Jun 2015 10:46:05 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <03E8811F981D44B6B627998DAA4FB615@XPS> <5957ADD01ADD4D1B9B1F009393B31FCE@XPS> Message-ID: Update: As of the last time running this, I got up to 72 reports. I watched my Mem Usage in my Task Manager slowly creep from 3.75 GB up to 5.15. And I do mean slowly creep. As soon as it hit 5.15, I got the out of resources error. When I clicked End, there was no change in resource consumption. And that fits with the sypmtom that as soon as I run out of resources, nothing can be edited in the database. I have got to find a way to stop this process from consuming resources. However, I note that even if I run only one style report (with about 30 outputted reports), and let the process end there, the mem usage does not decrease in order to enable me to begin the next batch. I feel therefore that I am screwed, if I want to keep outputting to PDF. When I kill Access, I have 3.67 GB showing. When I load Access (but do not start his database) I have 3.71 GB showing. When I start this database I have 3.72 GB showing. When I enable macros, I have 3.75 GB showing. When I run some code that populates a list of reports to be run into some controls on my Form, I have 3.76GB showing. As I run the code that generates the PDF output reports, that creeps up to 5.15, as I said. This leads me to conclude that Ac2013 is willing to use WELL UNDER 2 GB of ram before declaring itself to be out of resources. I have an 8GB machine, running under Windows 7. From fuller.artful at gmail.com Fri Jun 5 09:47:49 2015 From: fuller.artful at gmail.com (Arthur Fuller) Date: Fri, 5 Jun 2015 10:47:49 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <03E8811F981D44B6B627998DAA4FB615@XPS> Message-ID: An approach that I learned from lister Jim Dettman, with whom I worked remotely for a while, and from whom I learned many things, might be of use to you. Jim used a technique that I had never even considered prior to working with him and learning how his app was structured. In essence, there wasn't one app but rather many -- and the many were all handled by Task Scheduler. Many of them performed exactly one task, then exited. They were schedule to run frequently, and did such things as Ask if a file exists in a folder, and if so, process it then exit, else just exit; print an End-of-Day report, then exit; and so on. Previous to working with Jim, I had habitually designed apps as all-in-one enterprise-wide apps, using security to restrict access to those entitled to the various levels. My approach, compared to Jim's, had at least three serious flaws: 1) the app was huge, and 2) it presented far more options than any given user at any given level might need, and 3) it required human intervention to do things such as print daily, weekly and monthly reports, which in turn demanded that some human remember to execute them. Each of the numerous Access apps took up very little disk space in Jim's scheme, and all that was required was a knowledge of Task Scheduler, which demands all of a few minutes of your time. Another advantage of Jim's approach is that whenever any given automated task demands revision, you have precisely one task to examine, and can avoid loading a monster app. You might consider this approach in your situation. Create a separate app for each report you need to run, then queue them up in Task Scheduler at a frequency appropriate to the situation. And then fogeddaboudit. Since Jim taught me this technique, I have done about a dozen free updates to apps I've written for previous clients, who were already happy with what I had delivered, but I did it in the spirit of sharing new discoveries, and I guess, also to win some Brownie points with said clients. To Jim: thanks again for leading me to a better way. Arthur ? From jimdettman at verizon.net Fri Jun 5 09:51:06 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Fri, 05 Jun 2015 10:51:06 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <03E8811F981D44B6B627998DAA4FB615@XPS> <5957ADD01ADD4D1B9B1F009393B31FCE@XPS> Message-ID: <8DF651C99E7C4CF684E2AF22A8D8E8BA@XPS> <> You opened it when you did the Set (it's an implicit open). The querydef oject is an odd duck in that way and the only one where that is done within DAO. << Personally I hate error handline because it doesn't show the line of code where the failure occurs. >> Use MZ Tools (Freeware) to number all the code lines. Then in your error handler, use the undocumented vba.erl method to return the line. I usually use constants as well for module, procedure, and version. Here's what my call looks like: AppAlreadyUp_Error: 350 UnexpectedError ModuleName, RoutineName, Version, Err.Number, Err.Description, Err.Source, VBA.Erl 360 Resume AppAlreadyUp_Exit And here is what I get: ============================================================= An application event was logged: Msgbox Title: Traffic Monitor Ver 7.44 - Unexpected error Message: The application has encountered an unexpected error. App Name: Traffic Monitor Version: 7.44 Station Name: xxxxxx User Name: xxxxxx Module: frmTM Routine: cmdShipDate_Click Version: 2.0 Error Number: -2147217887 Description: Overflow Source: Microsoft JET Database Engine Line number: 130 ================================================================= That really pin-points errors, handles them nicely, and I don't have to handle in-line if I don't want to. <> Use of the : and two statements in a single line. i.e. DB.QueryDefs.Refresh: Set QDF = Nothing <> Quite possibly. At least now you know you've covered all the normal stuff. To try and test that, output in a different format and see if it still fails. If not, there are other ways to do PDF's. Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Friday, June 05, 2015 10:33 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources <> From jimdettman at verizon.net Fri Jun 5 09:58:22 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Fri, 05 Jun 2015 10:58:22 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <03E8811F981D44B6B627998DAA4FB615@XPS> <5957ADD01ADD4D1B9B1F009393B31FCE@XPS> Message-ID: <804BD873444D46CD8CB9E942F2DD17A2@XPS> <> "Resources" can mean many things, not just memory. One thing I mean to mention was adding the line: dbEngine.Setoption dbMaxLocksPerFile, 100000 and see if it flies. Not sure how many records your dealing with (and it sounds more like you have an actual resource leak), but running out of locks is another common source of "out of resources". This one though typically manifests when you have very large recordsets. Won't hurt to try it though and it's easy to do. Another common resource that runs out is table ID's. Internally Access uses table IDs for tracking open table objects and has a limit that floats around 2048. That sounds like a lot, but a table ID is used whenever something refers to a table (not only a table that's opened, but fields, controls, etc), so it's easy to run out. Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Friday, June 05, 2015 10:46 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources Update: As of the last time running this, I got up to 72 reports. I watched my Mem Usage in my Task Manager slowly creep from 3.75 GB up to 5.15. And I do mean slowly creep. As soon as it hit 5.15, I got the out of resources error. When I clicked End, there was no change in resource consumption. And that fits with the sypmtom that as soon as I run out of resources, nothing can be edited in the database. I have got to find a way to stop this process from consuming resources. However, I note that even if I run only one style report (with about 30 outputted reports), and let the process end there, the mem usage does not decrease in order to enable me to begin the next batch. I feel therefore that I am screwed, if I want to keep outputting to PDF. When I kill Access, I have 3.67 GB showing. When I load Access (but do not start his database) I have 3.71 GB showing. When I start this database I have 3.72 GB showing. When I enable macros, I have 3.75 GB showing. When I run some code that populates a list of reports to be run into some controls on my Form, I have 3.76GB showing. As I run the code that generates the PDF output reports, that creeps up to 5.15, as I said. This leads me to conclude that Ac2013 is willing to use WELL UNDER 2 GB of ram before declaring itself to be out of resources. I have an 8GB machine, running under Windows 7. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From jimdettman at verizon.net Fri Jun 5 10:08:13 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Fri, 05 Jun 2015 11:08:13 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <03E8811F981D44B6B627998DAA4FB615@XPS> Message-ID: Thanks Arthur. Wish I could claim credit for that, but alas, I'm certainly not the first to do it that way. I have found over the years that it's an approach that works pretty darn well all things considered. Not withstanding Access alone, any product has bugs and moving away from monolithic apps and/or apps that stay running constantly always runs a risk of those bugs rising to the surface. Access seems to be a bit more so than most, so with it I really try and trend in that direction, and most certainly when it comes to things like batching reports and processes that run on a schedule. I think if Microsoft had invested a little more time into VBA, it would be a lot more solid. As we all know, it's terrible at garbage collection and problems like this are a little more frequent then we'd all like to see. Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Friday, June 05, 2015 10:48 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources An approach that I learned from lister Jim Dettman, with whom I worked remotely for a while, and from whom I learned many things, might be of use to you. Jim used a technique that I had never even considered prior to working with him and learning how his app was structured. In essence, there wasn't one app but rather many -- and the many were all handled by Task Scheduler. Many of them performed exactly one task, then exited. They were schedule to run frequently, and did such things as Ask if a file exists in a folder, and if so, process it then exit, else just exit; print an End-of-Day report, then exit; and so on. Previous to working with Jim, I had habitually designed apps as all-in-one enterprise-wide apps, using security to restrict access to those entitled to the various levels. My approach, compared to Jim's, had at least three serious flaws: 1) the app was huge, and 2) it presented far more options than any given user at any given level might need, and 3) it required human intervention to do things such as print daily, weekly and monthly reports, which in turn demanded that some human remember to execute them. Each of the numerous Access apps took up very little disk space in Jim's scheme, and all that was required was a knowledge of Task Scheduler, which demands all of a few minutes of your time. Another advantage of Jim's approach is that whenever any given automated task demands revision, you have precisely one task to examine, and can avoid loading a monster app. You might consider this approach in your situation. Create a separate app for each report you need to run, then queue them up in Task Scheduler at a frequency appropriate to the situation. And then fogeddaboudit. Since Jim taught me this technique, I have done about a dozen free updates to apps I've written for previous clients, who were already happy with what I had delivered, but I did it in the spirit of sharing new discoveries, and I guess, also to win some Brownie points with said clients. To Jim: thanks again for leading me to a better way. Arthur ? -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Fri Jun 5 10:53:37 2015 From: bensonforums at gmail.com (Bill Benson) Date: Fri, 5 Jun 2015 11:53:37 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <804BD873444D46CD8CB9E942F2DD17A2@XPS> References: <03E8811F981D44B6B627998DAA4FB615@XPS> <5957ADD01ADD4D1B9B1F009393B31FCE@XPS> <804BD873444D46CD8CB9E942F2DD17A2@XPS> Message-ID: I switched to rtf (nevermind the crappy output look) - just to see if the fileformat was an issue. Same problem. Eventual resource (memory) creep with each call to DoCmd.OutputTo acOutputReport, "rptDeliverableManager", acFormatRTF, strReportPath It just seems to be the case that outputting a report results in an accretive and permanent allocation of scarce resources and I am going to have to manipulate query output in Excel (after I test whether outputting several dozens of queries using TransferSpreadsheet doesn't cause the same exact or similar problem). It is interesting that there are so few posts about this on the web (and no solutions). Or I have found so few/none anyway. On Fri, Jun 5, 2015 at 10:58 AM, Jim Dettman wrote: > < of > ram before declaring itself to be out of resources.>> > > "Resources" can mean many things, not just memory. > > One thing I mean to mention was adding the line: > > dbEngine.Setoption dbMaxLocksPerFile, 100000 > > and see if it flies. Not sure how many records your dealing with (and it > sounds more like you have an actual resource leak), but running out of > locks > is another common source of "out of resources". This one though typically > manifests when you have very large recordsets. Won't hurt to try it though > and it's easy to do. > > Another common resource that runs out is table ID's. Internally Access > uses table IDs for tracking open table objects and has a limit that floats > around 2048. That sounds like a lot, but a table ID is used whenever > something refers to a table (not only a table that's opened, but fields, > controls, etc), so it's easy to run out. > > Jim. > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Friday, June 05, 2015 10:46 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 running out of resources > > Update: > > As of the last time running this, I got up to 72 reports. I watched my Mem > Usage in my Task Manager slowly creep from 3.75 GB up to 5.15. And I do > mean slowly creep. As soon as it hit 5.15, I got the out of resources > error. When I clicked End, there was no change in resource consumption. And > that fits with the sypmtom that as soon as I run out of resources, nothing > can be edited in the database. > > I have got to find a way to stop this process from consuming resources. > However, I note that even if I run only one style report (with about 30 > outputted reports), and let the process end there, the mem usage does not > decrease in order to enable me to begin the next batch. I feel therefore > that I am screwed, if I want to keep outputting to PDF. > > When I kill Access, I have 3.67 GB showing. > > When I load Access (but do not start his database) I have 3.71 GB showing. > > When I start this database I have 3.72 GB showing. > > When I enable macros, I have 3.75 GB showing. > > When I run some code that populates a list of reports to be run into some > controls on my Form, I have 3.76GB showing. > > As I run the code that generates the PDF output reports, that creeps up to > 5.15, as I said. > > This leads me to conclude that Ac2013 is willing to use WELL UNDER 2 GB of > ram before declaring itself to be out of resources. > > I have an 8GB machine, running under Windows 7. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From jimdettman at verizon.net Fri Jun 5 11:18:32 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Fri, 05 Jun 2015 12:18:32 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <03E8811F981D44B6B627998DAA4FB615@XPS> <5957ADD01ADD4D1B9B1F009393B31FCE@XPS> <804BD873444D46CD8CB9E942F2DD17A2@XPS> Message-ID: Which version of A2013? 32 or 64 bit? Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Friday, June 05, 2015 11:54 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources I switched to rtf (nevermind the crappy output look) - just to see if the fileformat was an issue. Same problem. Eventual resource (memory) creep with each call to DoCmd.OutputTo acOutputReport, "rptDeliverableManager", acFormatRTF, strReportPath It just seems to be the case that outputting a report results in an accretive and permanent allocation of scarce resources and I am going to have to manipulate query output in Excel (after I test whether outputting several dozens of queries using TransferSpreadsheet doesn't cause the same exact or similar problem). It is interesting that there are so few posts about this on the web (and no solutions). Or I have found so few/none anyway. On Fri, Jun 5, 2015 at 10:58 AM, Jim Dettman wrote: > < of > ram before declaring itself to be out of resources.>> > > "Resources" can mean many things, not just memory. > > One thing I mean to mention was adding the line: > > dbEngine.Setoption dbMaxLocksPerFile, 100000 > > and see if it flies. Not sure how many records your dealing with (and it > sounds more like you have an actual resource leak), but running out of > locks > is another common source of "out of resources". This one though typically > manifests when you have very large recordsets. Won't hurt to try it though > and it's easy to do. > > Another common resource that runs out is table ID's. Internally Access > uses table IDs for tracking open table objects and has a limit that floats > around 2048. That sounds like a lot, but a table ID is used whenever > something refers to a table (not only a table that's opened, but fields, > controls, etc), so it's easy to run out. > > Jim. > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Friday, June 05, 2015 10:46 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 running out of resources > > Update: > > As of the last time running this, I got up to 72 reports. I watched my Mem > Usage in my Task Manager slowly creep from 3.75 GB up to 5.15. And I do > mean slowly creep. As soon as it hit 5.15, I got the out of resources > error. When I clicked End, there was no change in resource consumption. And > that fits with the sypmtom that as soon as I run out of resources, nothing > can be edited in the database. > > I have got to find a way to stop this process from consuming resources. > However, I note that even if I run only one style report (with about 30 > outputted reports), and let the process end there, the mem usage does not > decrease in order to enable me to begin the next batch. I feel therefore > that I am screwed, if I want to keep outputting to PDF. > > When I kill Access, I have 3.67 GB showing. > > When I load Access (but do not start his database) I have 3.71 GB showing. > > When I start this database I have 3.72 GB showing. > > When I enable macros, I have 3.75 GB showing. > > When I run some code that populates a list of reports to be run into some > controls on my Form, I have 3.76GB showing. > > As I run the code that generates the PDF output reports, that creeps up to > 5.15, as I said. > > This leads me to conclude that Ac2013 is willing to use WELL UNDER 2 GB of > ram before declaring itself to be out of resources. > > I have an 8GB machine, running under Windows 7. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From df.waters at outlook.com Fri Jun 5 11:25:06 2015 From: df.waters at outlook.com (Dan Waters) Date: Fri, 5 Jun 2015 11:25:06 -0500 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: <03E8811F981D44B6B627998DAA4FB615@XPS> <5957ADD01ADD4D1B9B1F009393B31FCE@XPS> <804BD873444D46CD8CB9E942F2DD17A2@XPS> Message-ID: Hello! I haven't been following this in detail, but I also have had a problem with Docmd.OutputTo. When using DoCmd.OutputTo you must have a software object opened before the DoCmd.OutputTo method is called. You can just open a query which returns no records to easily accomplish this. After you're not using DoCmd.OutputTo any more then close the query. This came from KB244695 quite a while ago. From my experience it is still a valid issue (at least in Access 2010). HTH! Dan -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Friday, June 05, 2015 10:54 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources I switched to rtf (nevermind the crappy output look) - just to see if the fileformat was an issue. Same problem. Eventual resource (memory) creep with each call to DoCmd.OutputTo acOutputReport, "rptDeliverableManager", acFormatRTF, strReportPath It just seems to be the case that outputting a report results in an accretive and permanent allocation of scarce resources and I am going to have to manipulate query output in Excel (after I test whether outputting several dozens of queries using TransferSpreadsheet doesn't cause the same exact or similar problem). It is interesting that there are so few posts about this on the web (and no solutions). Or I have found so few/none anyway. On Fri, Jun 5, 2015 at 10:58 AM, Jim Dettman wrote: > < GB of ram before declaring itself to be out of resources.>> > > "Resources" can mean many things, not just memory. > > One thing I mean to mention was adding the line: > > dbEngine.Setoption dbMaxLocksPerFile, 100000 > > and see if it flies. Not sure how many records your dealing with > (and it sounds more like you have an actual resource leak), but > running out of locks is another common source of "out of resources". > This one though typically manifests when you have very large > recordsets. Won't hurt to try it though and it's easy to do. > > Another common resource that runs out is table ID's. Internally > Access uses table IDs for tracking open table objects and has a limit that floats > around 2048. That sounds like a lot, but a table ID is used whenever > something refers to a table (not only a table that's opened, but > fields, controls, etc), so it's easy to run out. > > Jim. > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of Bill Benson > Sent: Friday, June 05, 2015 10:46 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 running out of resources > > Update: > > As of the last time running this, I got up to 72 reports. I watched my > Mem Usage in my Task Manager slowly creep from 3.75 GB up to 5.15. And > I do mean slowly creep. As soon as it hit 5.15, I got the out of > resources error. When I clicked End, there was no change in resource > consumption. And that fits with the sypmtom that as soon as I run out > of resources, nothing can be edited in the database. > > I have got to find a way to stop this process from consuming resources. > However, I note that even if I run only one style report (with about > 30 outputted reports), and let the process end there, the mem usage > does not decrease in order to enable me to begin the next batch. I > feel therefore that I am screwed, if I want to keep outputting to PDF. > > When I kill Access, I have 3.67 GB showing. > > When I load Access (but do not start his database) I have 3.71 GB showing. > > When I start this database I have 3.72 GB showing. > > When I enable macros, I have 3.75 GB showing. > > When I run some code that populates a list of reports to be run into > some controls on my Form, I have 3.76GB showing. > > As I run the code that generates the PDF output reports, that creeps > up to 5.15, as I said. > > This leads me to conclude that Ac2013 is willing to use WELL UNDER 2 > GB of ram before declaring itself to be out of resources. > > I have an 8GB machine, running under Windows 7. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From accessd at shaw.ca Fri Jun 5 11:46:09 2015 From: accessd at shaw.ca (Jim Lawrence) Date: Fri, 5 Jun 2015 10:46:09 -0600 (MDT) Subject: [AccessD] Puzzling problem with querying In-Reply-To: Message-ID: <181675526.90018375.1433522769589.JavaMail.root@shaw.ca> Hi Arthur: Maybe that feature has been turned off in Windows 8.x, but I have no way of checking. Jim ----- Original Message ----- From: "Arthur Fuller" To: "Access Developers discussion and problem solving" Sent: Thursday, June 4, 2015 1:48:37 PM Subject: Re: [AccessD] Puzzling problem with querying Jim, Thanks for the suggestion, but it didn't work, using either the keystroke commands or the right-button click. O well. A. On Thu, Jun 4, 2015 at 1:58 PM, Jim Lawrence wrote: > Actually you can capture the text in most, if not all error messages, that > remain displayed on the screen. Just left-mouse-click, hold down and move > over the text as if you were capturing it, like in any document and ctrl-c > or right-mouse click...select copy. Then bring up a note window, click and > ctrl-v or right-mouse click...select paste. If you have done everything > right the text you dragged over, even though it did not highlight, should > then display. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From davidmcafee at gmail.com Fri Jun 5 12:15:50 2015 From: davidmcafee at gmail.com (David McAfee) Date: Fri, 5 Jun 2015 10:15:50 -0700 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: Message-ID: The reason that I open the report in acPreview prior to OutputTo PDF is because of the WHERE clause that I am using for the report. By everything I meant the dynamic SQL. Your method might be faster, but I try to use saved queries when possible. When I loop through recordsets I'll usually use a hidden form (or hidden field on a form) to store query parameters. >From my (bad) memory it looked like you were basically running two different queries as the source. One with FY data and one without? Where do the input parameters for the sub come from? Are they fields on a form and a button is pressed to run the sub? How many records does this return? "SELECT DISTINCT B.ID, B.Name AS [Engagement Manager], B.[first Name]" as FirstName, B.Email FROM ([User Information List] AS B INNER JOIN [PDR Tracking] AS A ON B.[ID] = A.[Tax Manager]) LEFT JOIN tblCityRegion ON B.City = tblCityRegion.City WHERE tblCityRegion.Region=""West""" How many records does the query "Deliverables by Eng Manager" return if you return all records (all managers & FY) for the given dates? Something like SELECT neededFields FROM SomeTables WHERE [Deal Status] like 'Signed*' AND tblCityRegion.Region='West' AND [Sign Date] BETWEEN #" & strStartDate & "# AND #" & strEndDate & "#" Why are you deleting and inserting into tblBatch reports near the end? Can you just update the record(s) instead of deleting them and reinserting them with additional data? On Thu, Jun 4, 2015 at 5:04 PM, Bill Benson wrote: > If I don't do it all in VBA, then the user will be stuck sending each > report individually, no? > > Why do you open the report first, what is that accomplishing? I don't see > any pause occurring in your code, but what happens when you are opening the > report in preview view? > > I don't understand what you are saying regarding changing the WHERE clause > to a string, is that a way of limiting what the report shows? Isn't that > what I am accomplishing by editing the query sql? > > Would I be better off changing the recordsource for the report, by creating > a new query each time rather than the same query? > > I will try opening the report as you do, then printing it, and then closing > it - so long as this doesn't interrupt the process. > > From kost36 at otenet.gr Sat Jun 6 05:42:15 2015 From: kost36 at otenet.gr (Kostas Konstantinidis) Date: Sat, 6 Jun 2015 13:42:15 +0300 Subject: [AccessD] How to display positive or negative number in report Message-ID: Hi all, I use +#.###;-#.###;#.### as format to display positive or negative numbers in form But how to syntax it to display in report specially if the number is part of an unbound like? = "some text" & [score] & " some other text" [score] is the number field thank?s a lot /kostas From gustav at cactus.dk Sat Jun 6 05:56:37 2015 From: gustav at cactus.dk (Gustav Brock) Date: Sat, 6 Jun 2015 10:56:37 +0000 Subject: [AccessD] How to display positive or negative number in report In-Reply-To: References: Message-ID: Hi Kostas I once made a function for this: Public Function SgnStr(ByVal dblVal As Double) As String ' Returns plus or minus sign or space as string according to sign of dblVal. ' One-line alternative: ' SgnStr = Chr(((Asc(dblVal) = 48) * 12) + 44 - Sgn(dblVal)) ' Ascii Value for character between Plus (43) and Minus (45). Const clngAscSign As Long = 44 Dim strSign As String * 1 If dblVal = 0 Then ' Return empty string. Else ' Return sign. strSign = Chr(clngAscSign - Sgn(dblVal)) End If SgnStr = strSign End Function ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 12:42 Til: Access Developers discussion and problem solving Emne: [AccessD] How to display positive or negative number in report Hi all, I use +#.###;-#.###;#.### as format to display positive or negative numbers in form But how to syntax it to display in report specially if the number is part of an unbound like? = "some text" & [score] & " some other text" [score] is the number field thank?s a lot /kostas From kost36 at otenet.gr Sat Jun 6 06:13:03 2015 From: kost36 at otenet.gr (Kostas Konstantinidis) Date: Sat, 6 Jun 2015 14:13:03 +0300 Subject: [AccessD] How to display positive or negative number in report In-Reply-To: References: Message-ID: <1B9EB250202F4D5191B1CE91E7B1B5BE@kost36PC> HI Gustav, How to call the function on Details OnFormat? thank's for your quickly response /kostas -----?????? ??????----- From: Gustav Brock Sent: Saturday, June 06, 2015 1:56 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] How to display positive or negative number in report Hi Kostas I once made a function for this: Public Function SgnStr(ByVal dblVal As Double) As String ' Returns plus or minus sign or space as string according to sign of dblVal. ' One-line alternative: ' SgnStr = Chr(((Asc(dblVal) = 48) * 12) + 44 - Sgn(dblVal)) ' Ascii Value for character between Plus (43) and Minus (45). Const clngAscSign As Long = 44 Dim strSign As String * 1 If dblVal = 0 Then ' Return empty string. Else ' Return sign. strSign = Chr(clngAscSign - Sgn(dblVal)) End If SgnStr = strSign End Function ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 12:42 Til: Access Developers discussion and problem solving Emne: [AccessD] How to display positive or negative number in report Hi all, I use +#.###;-#.###;#.### as format to display positive or negative numbers in form But how to syntax it to display in report specially if the number is part of an unbound like? = "some text" & [score] & " some other text" [score] is the number field thank?s a lot /kostas -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From gustav at cactus.dk Sat Jun 6 06:19:51 2015 From: gustav at cactus.dk (Gustav Brock) Date: Sat, 6 Jun 2015 11:19:51 +0000 Subject: [AccessD] How to display positive or negative number in report In-Reply-To: <1B9EB250202F4D5191B1CE91E7B1B5BE@kost36PC> References: , <1B9EB250202F4D5191B1CE91E7B1B5BE@kost36PC> Message-ID: Hi Kostas You could just include it: ="some text " & SgnStr([score]) & CStr([score]) & " some other text" /gustav ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 13:13 Til: Access Developers discussion and problem solving Emne: Re: [AccessD] How to display positive or negative number in report HI Gustav, How to call the function on Details OnFormat? thank's for your quickly response /kostas -----?????? ??????----- From: Gustav Brock Sent: Saturday, June 06, 2015 1:56 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] How to display positive or negative number in report Hi Kostas I once made a function for this: Public Function SgnStr(ByVal dblVal As Double) As String ' Returns plus or minus sign or space as string according to sign of dblVal. ' One-line alternative: ' SgnStr = Chr(((Asc(dblVal) = 48) * 12) + 44 - Sgn(dblVal)) ' Ascii Value for character between Plus (43) and Minus (45). Const clngAscSign As Long = 44 Dim strSign As String * 1 If dblVal = 0 Then ' Return empty string. Else ' Return sign. strSign = Chr(clngAscSign - Sgn(dblVal)) End If SgnStr = strSign End Function ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 12:42 Til: Access Developers discussion and problem solving Emne: [AccessD] How to display positive or negative number in report Hi all, I use +#.###;-#.###;#.### as format to display positive or negative numbers in form But how to syntax it to display in report specially if the number is part of an unbound like? = "some text" & [score] & " some other text" [score] is the number field thank?s a lot /kostas From kost36 at otenet.gr Sat Jun 6 06:29:28 2015 From: kost36 at otenet.gr (Kostas Konstantinidis) Date: Sat, 6 Jun 2015 14:29:28 +0300 Subject: [AccessD] How to display positive or negative number in report In-Reply-To: References: , <1B9EB250202F4D5191B1CE91E7B1B5BE@kost36PC> Message-ID: yes... Gustav, many thank's /kostas -----?????? ??????----- From: Gustav Brock Sent: Saturday, June 06, 2015 2:19 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] How to display positive or negative number in report Hi Kostas You could just include it: ="some text " & SgnStr([score]) & CStr([score]) & " some other text" /gustav ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 13:13 Til: Access Developers discussion and problem solving Emne: Re: [AccessD] How to display positive or negative number in report HI Gustav, How to call the function on Details OnFormat? thank's for your quickly response /kostas -----?????? ??????----- From: Gustav Brock Sent: Saturday, June 06, 2015 1:56 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] How to display positive or negative number in report Hi Kostas I once made a function for this: Public Function SgnStr(ByVal dblVal As Double) As String ' Returns plus or minus sign or space as string according to sign of dblVal. ' One-line alternative: ' SgnStr = Chr(((Asc(dblVal) = 48) * 12) + 44 - Sgn(dblVal)) ' Ascii Value for character between Plus (43) and Minus (45). Const clngAscSign As Long = 44 Dim strSign As String * 1 If dblVal = 0 Then ' Return empty string. Else ' Return sign. strSign = Chr(clngAscSign - Sgn(dblVal)) End If SgnStr = strSign End Function ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 12:42 Til: Access Developers discussion and problem solving Emne: [AccessD] How to display positive or negative number in report Hi all, I use +#.###;-#.###;#.### as format to display positive or negative numbers in form But how to syntax it to display in report specially if the number is part of an unbound like? = "some text" & [score] & " some other text" [score] is the number field thank?s a lot /kostas -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From kost36 at otenet.gr Sat Jun 6 06:41:03 2015 From: kost36 at otenet.gr (Kostas Konstantinidis) Date: Sat, 6 Jun 2015 14:41:03 +0300 Subject: [AccessD] How to display positive or negative number in report In-Reply-To: References: , <1B9EB250202F4D5191B1CE91E7B1B5BE@kost36PC> Message-ID: Gustav, just noticed that if the number is negative e.g. -2 it returns double minor some text --2 some text thank's /kostas -----?????? ??????----- From: Kostas Konstantinidis Sent: Saturday, June 06, 2015 2:29 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] How to display positive or negative number in report yes... Gustav, many thank's /kostas -----?????? ??????----- From: Gustav Brock Sent: Saturday, June 06, 2015 2:19 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] How to display positive or negative number in report Hi Kostas You could just include it: ="some text " & SgnStr([score]) & CStr([score]) & " some other text" /gustav ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 13:13 Til: Access Developers discussion and problem solving Emne: Re: [AccessD] How to display positive or negative number in report HI Gustav, How to call the function on Details OnFormat? thank's for your quickly response /kostas -----?????? ??????----- From: Gustav Brock Sent: Saturday, June 06, 2015 1:56 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] How to display positive or negative number in report Hi Kostas I once made a function for this: Public Function SgnStr(ByVal dblVal As Double) As String ' Returns plus or minus sign or space as string according to sign of dblVal. ' One-line alternative: ' SgnStr = Chr(((Asc(dblVal) = 48) * 12) + 44 - Sgn(dblVal)) ' Ascii Value for character between Plus (43) and Minus (45). Const clngAscSign As Long = 44 Dim strSign As String * 1 If dblVal = 0 Then ' Return empty string. Else ' Return sign. strSign = Chr(clngAscSign - Sgn(dblVal)) End If SgnStr = strSign End Function ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 12:42 Til: Access Developers discussion and problem solving Emne: [AccessD] How to display positive or negative number in report Hi all, I use +#.###;-#.###;#.### as format to display positive or negative numbers in form But how to syntax it to display in report specially if the number is part of an unbound like? = "some text" & [score] & " some other text" [score] is the number field thank?s a lot /kostas -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From gustav at cactus.dk Sat Jun 6 06:48:06 2015 From: gustav at cactus.dk (Gustav Brock) Date: Sat, 6 Jun 2015 11:48:06 +0000 Subject: [AccessD] How to display positive or negative number in report In-Reply-To: References: , <1B9EB250202F4D5191B1CE91E7B1B5BE@kost36PC> , Message-ID: Hi Kostas Oh, that's right - the original purpose of the functions was just to indicate positive/negative. Use Abs to correct: ="some text " & SgnStr([score]) & CStr(Abs([score])) & " some other text" /gustav ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 13:41 Til: Access Developers discussion and problem solving Emne: Re: [AccessD] How to display positive or negative number in report Gustav, just noticed that if the number is negative e.g. -2 it returns double minor some text --2 some text thank's /kostas From kost36 at otenet.gr Sat Jun 6 07:07:38 2015 From: kost36 at otenet.gr (Kostas Konstantinidis) Date: Sat, 6 Jun 2015 15:07:38 +0300 Subject: [AccessD] How to display positive or negative number in report In-Reply-To: References: , <1B9EB250202F4D5191B1CE91E7B1B5BE@kost36PC>, Message-ID: <37A7A792B0C44894809975558FAC4DFE@kost36PC> yeap... now it works perfect thank's Gustav /kostas -----?????? ??????----- From: Gustav Brock Sent: Saturday, June 06, 2015 2:48 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] How to display positive or negative number in report Hi Kostas Oh, that's right - the original purpose of the functions was just to indicate positive/negative. Use Abs to correct: ="some text " & SgnStr([score]) & CStr(Abs([score])) & " some other text" /gustav ________________________________________ Fra: AccessD p? vegne af Kostas Konstantinidis Sendt: 6. juni 2015 13:41 Til: Access Developers discussion and problem solving Emne: Re: [AccessD] How to display positive or negative number in report Gustav, just noticed that if the number is negative e.g. -2 it returns double minor some text --2 some text thank's /kostas -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Sat Jun 6 10:01:26 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sat, 6 Jun 2015 11:01:26 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: Message-ID: I tried the procedure with opening the report first. This accomplished nothing for me other than slowing things down, and giving visual indication of what was being output - more of a nuisance than otherwise a benefit. So the performance was worsened and the resource creep slowed, time wise, but exactly the same if not worse, count wise... in truth, what I kinda expected though I admit to guarded optimism at the beginning. I am going to write the routine differently to keep track of which reports have spooled and ask the user to quit the application at certain points in the batch. Then adjust the auto exec to pick up where things left off when the application is restarted until batch exhausted. Nothing else I can do. The second database approach is viable but the owner does not want to have to have all their users maintain a second database and they are willing to live with interruption. In a side but related note - and this is worth all of your attention I believe... One of the times when resources were depleted, I was attempting to save, and after I shut and reopened the database, there was. NO VA CODE in any form, repirt, or standard module. Gone! The objects were still there but hidden from the VBE. I could import some objects from that database into a recovery database, but not forms, reports, or code modules. There names became reserved, but using the objects impossible. Thank God I had JUST copied my code out of the main standard module into a Notepad window. But I lost all the code behind my for and report, and had to rebuild those objects from scratch. Sucked, after all I had ready been through, and believe me I kicked myself for not having a servicable backup of these objects in another database. I really have to get more religious about making backups. From bensonforums at gmail.com Sat Jun 6 10:07:31 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sat, 6 Jun 2015 11:07:31 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: Message-ID: David, I was running only one query. I could do what you suggest about using a where clause for the report, rather than changing the SQ but the resource creep is due to the outputting of the report, not the report itself or the query. Every measure so far proposed, such as closing the querydef, setting objects to nothing, making the report based on separate queries (I actually ran make tables and tried running against those temp tables), opening the report before outputting.... nothing helped and I think a lot of times seasoned developers can trick themselves into assuming some small tweak has bearded the lion in its den in old days... I don't know if those techniques are valuable, best practice or otherwise, but in my case they were of no discernible improvement to performance. But I do thank Jim and you for ideas to try out. On Jun 5, 2015 1:16 PM, "David McAfee" wrote: > The reason that I open the report in acPreview prior to OutputTo PDF is > because of the WHERE clause that I am using for the report. > > By everything I meant the dynamic SQL. > Your method might be faster, but I try to use saved queries when possible. > > When I loop through recordsets I'll usually use a hidden form (or hidden > field on a form) to store query parameters. > From my (bad) memory it looked like you were basically running two > different queries as the source. > > One with FY data and one without? > > Where do the input parameters for the sub come from? Are they fields on a > form and a button is pressed to run the sub? > > How many records does this return? > "SELECT DISTINCT B.ID, B.Name AS [Engagement Manager], B.[first Name]" > as FirstName, B.Email FROM ([User Information List] AS B INNER JOIN [PDR > Tracking] AS A ON B.[ID] = A.[Tax Manager]) LEFT JOIN tblCityRegion ON > B.City = tblCityRegion.City WHERE tblCityRegion.Region=""West""" > > > How many records does the query "Deliverables by Eng Manager" return if you > return all records (all managers & FY) for the given dates? > > Something like > SELECT neededFields > FROM SomeTables > WHERE [Deal Status] like 'Signed*' > AND tblCityRegion.Region='West' > AND [Sign Date] BETWEEN #" & strStartDate & "# AND #" & strEndDate & "#" > > > Why are you deleting and inserting into tblBatch reports near the end? > Can you just update the record(s) instead of deleting them and reinserting > them with additional data? > > > > > > On Thu, Jun 4, 2015 at 5:04 PM, Bill Benson > wrote: > > > If I don't do it all in VBA, then the user will be stuck sending each > > report individually, no? > > > > Why do you open the report first, what is that accomplishing? I don't see > > any pause occurring in your code, but what happens when you are opening > the > > report in preview view? > > > > I don't understand what you are saying regarding changing the WHERE > clause > > to a string, is that a way of limiting what the report shows? Isn't that > > what I am accomplishing by editing the query sql? > > > > Would I be better off changing the recordsource for the report, by > creating > > a new query each time rather than the same query? > > > > I will try opening the report as you do, then printing it, and then > closing > > it - so long as this doesn't interrupt the process. > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From edzedz at comcast.net Sat Jun 6 11:48:05 2015 From: edzedz at comcast.net (Edward Zuris) Date: Sat, 6 Jun 2015 10:48:05 -0600 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: Message-ID: <201506061648.t56GmtRF026385@databaseadvisors.com> This 'Ac2013 running out of resources' topic has turned into an interesting read. Please forgive if some of this is repetitive. I have this problem a few times and over 90% of the time it is due something I did wrong in the VBA code. This may be off the wall, but could you be short on disk space and/or the pagefile is too small? On windows 7 get to Control Panel. When in System Properties select Performance Options. Then select the Visual Effects tab. Select Adjust for Best Performance. Then go to the Advance Tab, select best performance for Programs. For Virtual Memory I have that set for 65,534 MB. Virtual Memory is the pagefile. BTW, I use Excel has my report writer this I needs lots of memory. I do lots of VBA, in 2003, and I follow most of the rules others have suggested on this blog. It is old but it works. Many, many years ago I use to write complex code to impress friends, now I write to make the customers happy. Only a couple of times in 20+ year's customers even wanted to see the code. So I tend to break the code into its individual components. Thus instead of one complex statement, I'll use a half dozen lines of code, with a few comment lines thrown in. This makes it easer to find errors late a night when very tired. Thus I tend to try to reduce complexity in the VBA code and with the SQL commands such as removing complex joins or where-clauses. Thus to get around complex 'joins' or complex Where-Clauses a pre-defined temp table is reset. One pass is used to just extract data from the main data source. If using something like ODBC, etc., try to use server side cursors with the minimum of where-clauses this keep most of the data on server, else Access might try to bring everything over to do the selecting and filtering on the local machine. For each 'join' do an Update pass filling in the appropriate fields within the pre-defined temp table. For complex Where-Clauses have some flag-fields that are turned ON or Off for multiple passes thru the pre-defined temp table eventually arriving at the data set you are looking for. You will eventually have a master select field like "UseThisRecord." This is a clunky way to get around some problems, but this is method from the very old IBM Unit Record Machine days. Yes I am that old. Enjoy. Sincerely, Ed. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Saturday, June 06, 2015 9:08 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources David, I was running only one query. I could do what you suggest about using a where clause for the report, rather than changing the SQ but the resource creep is due to the outputting of the report, not the report itself or the query. Every measure so far proposed, such as closing the querydef, setting objects to nothing, making the report based on separate queries (I actually ran make tables and tried running against those temp tables), opening the report before outputting.... nothing helped and I think a lot of times seasoned developers can trick themselves into assuming some small tweak has bearded the lion in its den in old days... I don't know if those techniques are valuable, best practice or otherwise, but in my case they were of no discernible improvement to performance. But I do thank Jim and you for ideas to try out. On Jun 5, 2015 1:16 PM, "David McAfee" wrote: > The reason that I open the report in acPreview prior to OutputTo PDF is > because of the WHERE clause that I am using for the report. > > By everything I meant the dynamic SQL. > Your method might be faster, but I try to use saved queries when possible. > > When I loop through recordsets I'll usually use a hidden form (or hidden > field on a form) to store query parameters. > From my (bad) memory it looked like you were basically running two > different queries as the source. > > One with FY data and one without? > > Where do the input parameters for the sub come from? Are they fields on a > form and a button is pressed to run the sub? > > How many records does this return? > "SELECT DISTINCT B.ID, B.Name AS [Engagement Manager], B.[first Name]" > as FirstName, B.Email FROM ([User Information List] AS B INNER JOIN [PDR > Tracking] AS A ON B.[ID] = A.[Tax Manager]) LEFT JOIN tblCityRegion ON > B.City = tblCityRegion.City WHERE tblCityRegion.Region=""West""" > > > How many records does the query "Deliverables by Eng Manager" return if you > return all records (all managers & FY) for the given dates? > > Something like > SELECT neededFields > FROM SomeTables > WHERE [Deal Status] like 'Signed*' > AND tblCityRegion.Region='West' > AND [Sign Date] BETWEEN #" & strStartDate & "# AND #" & strEndDate & "#" > > > Why are you deleting and inserting into tblBatch reports near the end? > Can you just update the record(s) instead of deleting them and reinserting > them with additional data? > > > > > > On Thu, Jun 4, 2015 at 5:04 PM, Bill Benson > wrote: > > > If I don't do it all in VBA, then the user will be stuck sending each > > report individually, no? > > > > Why do you open the report first, what is that accomplishing? I don't see > > any pause occurring in your code, but what happens when you are opening > the > > report in preview view? > > > > I don't understand what you are saying regarding changing the WHERE > clause > > to a string, is that a way of limiting what the report shows? Isn't that > > what I am accomplishing by editing the query sql? > > > > Would I be better off changing the recordsource for the report, by > creating > > a new query each time rather than the same query? > > > > I will try opening the report as you do, then printing it, and then > closing > > it - so long as this doesn't interrupt the process. > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Sat Jun 6 16:15:10 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sat, 6 Jun 2015 17:15:10 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <201506061648.t56GmtRF026385@databaseadvisors.com> References: <201506061648.t56GmtRF026385@databaseadvisors.com> Message-ID: Edward, I switched the report to not run ANY SQL during the report creation, ie, to run the reports with no where clauses and based on very simple tables that were created along the way from a make table query. Rehardless, the out of resources issue persisted. My vba is, I believe, pretty basic, no pun intended. I don't see much that could or should be simplified, but what minor changes were proposed, I followed - those improvements didn't help. My queries are hardly complex, in my view, having written far more complex queries in the past. And again, I forsook them to run reports against tables instead. The one thing I did not try was creating a few hundred temp queries in the database and running a single report with revolving recordsource - instead of altering the SQL in a single querydef. However, since I got no improvement using tables instead, I cannot imagine anything to be gained from this new strategy. As for system tweaks, I have not considered memory management because I could never control this for all potential users of the software. I think some of this guidance is appropriate for other situations, I just don't see it as all that relating to my problem. Maybe I am myopic and stubborn and can't see a problem that is right under my own nose, or one which I am too close to, to see. In any case I appreciate the concern and devotion of yourself and others on this List, but I think this is a situation where Access, not the developer, is at fault. From edzedz at comcast.net Sat Jun 6 16:52:04 2015 From: edzedz at comcast.net (Edward Zuris) Date: Sat, 6 Jun 2015 15:52:04 -0600 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: Message-ID: <201506062152.t56Lqrse026794@databaseadvisors.com> "I think this is a situation where Access, not the developer, is at fault." That could be true. When I was brown-badge at MSFT we were told to call anomalies features. I spend a lot of time working around features. Maybe the report-writer has a memory leak feature. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Saturday, June 06, 2015 3:15 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 running out of resources Edward, I switched the report to not run ANY SQL during the report creation, ie, to run the reports with no where clauses and based on very simple tables that were created along the way from a make table query. Rehardless, the out of resources issue persisted. My vba is, I believe, pretty basic, no pun intended. I don't see much that could or should be simplified, but what minor changes were proposed, I followed - those improvements didn't help. My queries are hardly complex, in my view, having written far more complex queries in the past. And again, I forsook them to run reports against tables instead. The one thing I did not try was creating a few hundred temp queries in the database and running a single report with revolving recordsource - instead of altering the SQL in a single querydef. However, since I got no improvement using tables instead, I cannot imagine anything to be gained from this new strategy. As for system tweaks, I have not considered memory management because I could never control this for all potential users of the software. I think some of this guidance is appropriate for other situations, I just don't see it as all that relating to my problem. Maybe I am myopic and stubborn and can't see a problem that is right under my own nose, or one which I am too close to, to see. In any case I appreciate the concern and devotion of yourself and others on this List, but I think this is a situation where Access, not the developer, is at fault. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Sat Jun 6 23:47:22 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sun, 7 Jun 2015 00:47:22 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <201506062152.t56Lqrse026794@databaseadvisors.com> References: <201506062152.t56Lqrse026794@databaseadvisors.com> Message-ID: That was exactly the comic relief I needed! I just finished rewriting the database to record which reports will be run, then update each report with a spooled date flag, and after a certain report milestone, ask the user to shut down the database, and at startup I test if there are reports without a spooled date, prompt the user to continue from where spooling left off. I am sure my users will appreciate this "take a break from doing your reports" feature. If I can get the user to agree to a companion reporting database that I can automate, export data to, have it run reports and shut down, then this stilted, interrupted reporting session can be averted... until then they have to live with the work around. Thanks all. Learned nothing through this but distrust of Access2013, but I can always count on being humbled every time I hitch my star to MS Access. On Jun 6, 2015 5:53 PM, "Edward Zuris" wrote: > > "I think this is a situation where Access, not the developer, is at fault." > > That could be true. > > When I was brown-badge at MSFT we were told to call anomalies features. > > I spend a lot of time working around features. > > Maybe the report-writer has a memory leak feature. > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Saturday, June 06, 2015 3:15 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 running out of resources > > Edward, > > I switched the report to not run ANY SQL during the report creation, ie, > to run the reports with no where clauses and based on very simple tables > that were created along the way from a make table query. Rehardless, the > out of resources issue persisted. > > My vba is, I believe, pretty basic, no pun intended. I don't see much that > could or should be simplified, but what minor changes were proposed, I > followed - those improvements didn't help. > > My queries are hardly complex, in my view, having written far more complex > queries in the past. And again, I forsook them to run reports against > tables instead. The one thing I did not try was creating a few hundred temp > queries in the database and running a single report with revolving > recordsource - instead of altering the SQL in a single querydef. However, > since I got no improvement using tables instead, I cannot imagine anything > to be gained from this new strategy. > > As for system tweaks, I have not considered memory management because I > could never control this for all potential users of the software. > > I think some of this guidance is appropriate for other situations, I just > don't see it as all that relating to my problem. Maybe I am myopic and > stubborn and can't see a problem that is right under my own nose, or one > which I am too close to, to see. In any case I appreciate the concern and > devotion of yourself and others on this List, but I think this is a > situation where Access, not the developer, is at fault. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Sun Jun 7 06:58:20 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sun, 7 Jun 2015 07:58:20 -0400 Subject: [AccessD] How to tell how much resources have been used Message-ID: Recently I had some problems with Access consuming too many "resources" when trying to output some reports to disk consecutively, using VBA. I wrote a routine that interrupted the process at various stages and suggested the user quit Access and restart the database, then on startup, looks for where things left off and continues. Even though this mitigates risk, it is still possible for Access to run out of resources along the way at any particular stage it happens to open up and carry on from. I creating an alternative that automates a second instance of Access to run the reports. However this will add a significant amount of time to the running process. I would like therefore to know if there is a way to test how much RAM is being used by a process in order to permitting the 2nd instance to crank out reports up until an optimal stopping point. I found some code here https://goo.gl/g8ZkTT that purports to find the amount of available memory (plus a whole lot of other info) however (1) the amount is always being reported as a negative number (e.g., ?MemoryAvailable -475230208 Also, I am wondering if I would have to enhance the API definitions in order to accommodate Windows 8.1, which my Firm is movint towards. Anyone have experience with this API call and how to cover the bases I am conderned with? Option Compare Database Option Explicit Type MEMORYSTATUS dwLength As Long dwMemoryLoad As Long dwTotalPhys As Long dwAvailPhys As Long dwTotalPageFile As Long dwAvailPageFile As Long dwTotalVirtual As Long dwAvailVirtual As Long End Type Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As _ MEMORYSTATUS) Function MemoryAvailable() Dim msg As String ' Status information. Dim NewLine As String ' New-line. Dim ret As Integer ' OS Information Dim ver_major As Integer ' OS Version Dim ver_minor As Integer ' Minor Os Version Dim Build As Long ' OS Build Dim memsts As MEMORYSTATUS GlobalMemoryStatus memsts MemoryAvailable = memsts.dwAvailPhys 'MemoryAvailable = memsts.dwLength 'MemoryAvailable = memsts.dwMemoryLoad 'MemoryAvailable = memsts.dwTotalPhys 'MemoryAvailable = memsts.dwAvailPhys 'MemoryAvailable = memsts.dwTotalPageFile 'MemoryAvailable = memsts.dwAvailPageFile 'MemoryAvailable = memsts.dwTotalVirtual 'MemoryAvailable = memsts.dwAvailVirtual End Function From jackandpat.d at gmail.com Sun Jun 7 07:21:49 2015 From: jackandpat.d at gmail.com (jack drawbridge) Date: Sun, 7 Jun 2015 08:21:49 -0400 Subject: [AccessD] How to tell how much resources have been used In-Reply-To: References: Message-ID: Bill, I have never used the api and am not familiar with it. I did find this from years ago re negative values. http://bytes.com/topic/access/answers/208402-a97-why-negative-memory-values-reported And this: http://stackoverflow.com/questions/19550367/access-2010-system-resource-exceeded Good luck. On Sun, Jun 7, 2015 at 7:58 AM, Bill Benson wrote: > Recently I had some problems with Access consuming too many "resources" > when trying to output some reports to disk consecutively, using VBA. I > wrote a routine that interrupted the process at various stages and > suggested the user quit Access and restart the database, then on startup, > looks for where things left off and continues. Even though this mitigates > risk, it is still possible for Access to run out of resources along the way > at any particular stage it happens to open up and carry on from. I creating > an alternative that automates a second instance of Access to run the > reports. However this will add a significant amount of time to the running > process. I would like therefore to know if there is a way to test how much > RAM is being used by a process in order to permitting the 2nd instance to > crank out reports up until an optimal stopping point. > > I found some code here https://goo.gl/g8ZkTT that purports to find the > amount of available memory (plus a whole lot of other info) however (1) the > amount is always being reported as a negative number (e.g., > > ?MemoryAvailable > -475230208 > > Also, I am wondering if I would have to enhance the API definitions in > order to accommodate Windows 8.1, which my Firm is movint towards. > > Anyone have experience with this API call and how to cover the bases I am > conderned with? > > Option Compare Database > Option Explicit > Type MEMORYSTATUS > dwLength As Long > dwMemoryLoad As Long > dwTotalPhys As Long > dwAvailPhys As Long > dwTotalPageFile As Long > dwAvailPageFile As Long > dwTotalVirtual As Long > dwAvailVirtual As Long > End Type > Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As _ > MEMORYSTATUS) > > Function MemoryAvailable() > Dim msg As String ' Status information. > Dim NewLine As String ' New-line. > Dim ret As Integer ' OS Information > Dim ver_major As Integer ' OS Version > Dim ver_minor As Integer ' Minor Os Version > Dim Build As Long ' OS Build > Dim memsts As MEMORYSTATUS > GlobalMemoryStatus memsts > MemoryAvailable = memsts.dwAvailPhys > 'MemoryAvailable = memsts.dwLength > 'MemoryAvailable = memsts.dwMemoryLoad > 'MemoryAvailable = memsts.dwTotalPhys > 'MemoryAvailable = memsts.dwAvailPhys > 'MemoryAvailable = memsts.dwTotalPageFile > 'MemoryAvailable = memsts.dwAvailPageFile > 'MemoryAvailable = memsts.dwTotalVirtual > 'MemoryAvailable = memsts.dwAvailVirtual > End Function > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Sun Jun 7 08:19:15 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sun, 7 Jun 2015 09:19:15 -0400 Subject: [AccessD] How to tell how much resources have been used In-Reply-To: References: Message-ID: Jack - thank you. Those are two helful links to be sure! I rewrote the function. I don't understand a couple of things. One, I thought that it was reporting on global memory availability and/or usage, not any portion specific to the instance of Access I am in. Yet when I run it, it seems to come up with a value like 0.5 when I first open the database 1.03 when have run the first batch of reports If I open another instance of Access (same database), the numbers are again 0.5 when I first open the database 1.0x when have run the first batch of reports So it would appear to somehow be reporting on memory conditions local to the application I am using - which frankly I do not understand, given the nature of the APIs construction. How (given the two parameters passed) - is this function able to report only on what the local app is using? I don't mean to look a gift horse in the mouth - as it is doing EXACTLY what I need it to be doing ... but I would like to know how/why before I trust this for my purpose. Another issue: I read this on MSDN (https://goo.gl/HKwjkL): "On computers with more than 4 GB of memory, the *MEMORYSTATUS* structure can return incorrect information, reporting a value of ?1 to indicate an overflow. If your application is at risk for this behavior, use the *GlobalMemoryStatusEx* function instead of the *GlobalMemoryStatus* function" I have 8GB RAM and GlobalMemory seems to work, but I tried instead using GlobalMemoryStatusEx based on example code here (http://goo.gl/sxBJbG). Now I get a negative result, not even similar in magnitude. Seeing my intent, can you (or anyone) tell me what I may be doing wrong in my MemoryEXUsed function below? Also, how would I know a user of this application is "at risk" of falling afoul of *MEMORYSTATUS* limitations, seeing that for me, on my system - which is > 4GB - it appears to work well enough? Thanks again for that post! Option Compare Database Option Explicit Private Type ULARGE_INTEGER LowPart As Long HighPart As Long End Type Type MEMORYSTATUS dwLength As Long dwMemoryLoad As Long dwTotalPhys As Long dwAvailPhys As Long dwTotalPageFile As Long dwAvailPageFile As Long dwTotalVirtual As Long dwAvailVirtual As Long End Type Private Type MEMORY_STATUS_EX dwLength As Long dwMemoryLoad As Long ullTotalPhys As ULARGE_INTEGER ullAvailPhys As ULARGE_INTEGER ullTotalPageFile As ULARGE_INTEGER ullAvailPageFile As ULARGE_INTEGER ullTotalVirtual As ULARGE_INTEGER ullAvailVirtual As ULARGE_INTEGER ullAvailExtendedVirtual As ULARGE_INTEGER End Type Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As _ MEMORYSTATUS) Private Declare Function GlobalMemoryStatusEx Lib "kernel32.dll" (lpBuffer As MEMORY_STATUS_EX) As Long 'Private Declare Sub GlobalMemoryStatus Lib "kernel32.dll" (lpBuffer As MEMORY_STATUS) Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Function MemoryEXUsed() Dim MemTemp As Currency Dim X As MEMORY_STATUS_EX Dim AvailVirtualMem Dim VirtualMem X.dwLength = Len(X) GlobalMemoryStatusEx X CopyMemory MemTemp, X.ullAvailPageFile, Len(MemTemp) AvailVirtualMem = MemTemp CopyMemory MemTemp, X.ullTotalVirtual, Len(MemTemp) VirtualMem = MemTemp Debug.Print "VM: " & VirtualMem, "AVM: " & AvailVirtualMem MemoryEXUsed = VirtualMem - AvailVirtualMem Exit Function ' CopyMemory MemTemp, X.ullAvailPhys, Len(MemTemp) ' AvailMem = MemTemp ' AvailPageMem = Str(MemTemp) ' CopyMemory MemTemp, X.ullAvailVirtual, Len(MemTemp) ' LoadMem = Str(X.dwMemoryLoad) ' CopyMemory MemTemp, X.ullTotalPageFile, Len(MemTemp) ' PageMem = Str(MemTemp) ' CopyMemory MemTemp, X.ullTotalPhys, Len(MemTemp) ' PhysicalMem = Str(MemTemp) End Function Function MemoryUsed() Dim msg As String ' Status information. Dim memsts As MEMORYSTATUS GlobalMemoryStatus memsts MemoryUsed = Format((memsts.dwTotalVirtual - memsts.dwAvailVirtual) / 1073741824, "0.000") End Function On Sun, Jun 7, 2015 at 8:21 AM, jack drawbridge wrote: > Bill, > > I have never used the api and am not familiar with it. > I did find this from years ago re negative values. > > http://bytes.com/topic/access/answers/208402-a97-why-negative-memory-values-reported > > And this: > > http://stackoverflow.com/questions/19550367/access-2010-system-resource-exceeded > > Good luck. > > From bensonforums at gmail.com Sun Jun 7 11:57:56 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sun, 7 Jun 2015 12:57:56 -0400 Subject: [AccessD] How to tell how much resources have been used In-Reply-To: References: Message-ID: Here is another combination of APIs that I have no idea how they work but appears to gather how much memory is being used by the current process, and I hope is reliable since I am going to go with it... Option Compare Database Option Explicit Type PROCESS_MEMORY_COUNTERS cb As Long PageFaultCount As Long PeakWorkingSetSize As Long WorkingSetSize As Long QuotaPeakPagedPoolUsage As Long QuotaPagedPoolUsage As Long QuotaPeakNonPagedPoolUsage As Long QuotaNonPagedPoolUsage As Long PagefileUsage As Long PeakPagefileUsage As Long End Type Private Const PROCESS_QUERY_INFORMATION = 1024 Private Const PROCESS_VM_READ = 16 Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long Private Declare Function EnumProcessModules Lib "PSAPI.DLL" (ByVal hProcess As Long, lphModule As Long, ByVal cb As Long, lpcbNeeded As Long) As Long Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long Private Declare Function GetProcessMemoryInfo Lib "PSAPI.DLL" (ByVal hProcess As Long, ppsmemCounters As PROCESS_MEMORY_COUNTERS, ByVal cb As Long) As Long Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal Handle As Long) As Long Public Function GetCurrentProcessMemory() As Long Dim lngCBSize2 As Long Dim lngModules(1 To 200) As Long Dim lngReturn As Long Dim lngHwndProcess As Long Dim pmc As PROCESS_MEMORY_COUNTERS Dim lRet As Long Dim MemDelta As Long Static MemUsed As Long 'Get a handle to the Process and Open lngHwndProcess = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, 0, GetCurrentProcessId) If lngHwndProcess <> 0 Then 'Get an array of the module handles for the specified process lngReturn = EnumProcessModules(lngHwndProcess, lngModules(1), 200, lngCBSize2) 'If the Module Array is retrieved, Get the ModuleFileName If lngReturn <> 0 Then 'Get the Site of the Memory Structure pmc.cb = LenB(pmc) lRet = GetProcessMemoryInfo(lngHwndProcess, pmc, pmc.cb) GetCurrentProcessMemory = pmc.WorkingSetSize End If End If 'Close the handle to this process lngReturn = CloseHandle(lngHwndProcess) End Function From marksimms at verizon.net Sun Jun 7 13:01:16 2015 From: marksimms at verizon.net (Mark Simms) Date: Sun, 07 Jun 2015 14:01:16 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: Message-ID: <016201d0a14b$f6c6b0a0$e45411e0$@net> Interestingly gang- there was a hot fix for this resource problem for AC-2010. Would it be possible the AC-2013 dev team never incorporated this fix ? BTW:I like that setOption MaxLocks idea.....I'm going to try that. From bensonforums at gmail.com Sun Jun 7 13:59:07 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sun, 7 Jun 2015 14:59:07 -0400 Subject: [AccessD] How to tell how much resources have been used In-Reply-To: References: Message-ID: I put some metrics-oriented code around the routines, and found the results interesting. At time of the first suggestion to restart, Access had finished all the reports without reporting an error, however when I went to close the database, I was informed that there were not enough resources. I don't know what routines Access needs to run on shut down, but it is interesting that the last report got in just under the "wire." What I have learned from this attempt however is that there is really no safe number of reports that can be run prior to restart. So I am continuing to try to implement the suggestion given to run reports from a second instance of Access and shut it down. One thing I will be trying to do is monitor memory usage by the *second* instance of Access. I don't think I will be able to perform that monitoring from within the first instance, probably I will need have the called remote database run its own memory check, and export the result to a text file that the master instance can then open and read after each separate report is run. If a certain dangerous level is reached, then it would be time to restart the remote database. I am thinking along these lines because I would only want to start the remote instance as often as necessary for it to produce reports safely without running out of resources. It seems to be a process that consumes about 20 to 30 mb of resources per report being run. Anyone have additional thoughts / caveats? Memory in use: 680.6 mb before running any reports. Memory in use: 710.9 mb. Used 30.3 mb from running 1 report Memory in use: 732.1 mb. Used 51.4 mb from running 2 reports Memory in use: 749.1 mb. Used 68.5 mb from running 2 reports Memory in use: 770.0 mb. Used 89.4 mb from running 3 reports Memory in use: 790.0 mb. Used 109.3 mb from running 1 report Memory in use: 810.0 mb. Used 129.3 mb from running 2 reports Memory in use: 829.8 mb. Used 149.2 mb from running 3 reports Memory in use: 850.0 mb. Used 169.3 mb from running 4 reports Memory in use: 869.7 mb. Used 189.1 mb from running 5 reports Memory in use: 889.5 mb. Used 208.9 mb from running 6 reports Memory in use: 909.9 mb. Used 229.2 mb from running 7 reports Memory in use: 929.6 mb. Used 249.0 mb from running 8 reports Memory in use: 949.2 mb. Used 268.5 mb from running 9 reports Memory in use: 969.1 mb. Used 288.5 mb from running 10 reports Memory in use: 989.6 mb. Used 309.0 mb from running 11 reports Memory in use: 1009.2 mb. Used 328.5 mb from running 12 reports Memory in use: 1029.9 mb. Used 349.3 mb from running 13 reports Memory in use: 1049.4 mb. Used 368.7 mb from running 14 reports Memory in use: 1069.3 mb. Used 388.6 mb from running 15 reports Memory in use: 1089.3 mb. Used 408.7 mb from running 16 reports Memory in use: 1109.1 mb. Used 428.5 mb from running 17 reports Memory in use: 1129.5 mb. Used 448.9 mb from running 18 reports Memory in use: 1149.2 mb. Used 468.6 mb from running 19 reports Memory in use: 1169.1 mb. Used 488.5 mb from running 20 reports Memory in use: 1189.5 mb. Used 508.8 mb from running 21 reports Memory in use: 1209.7 mb. Used 529.0 mb from running 22 reports Memory in use: 1229.2 mb. Used 548.6 mb from running 23 reports Memory in use: 1248.7 mb. Used 568.1 mb from running 24 reports Memory in use: 1268.7 mb. Used 588.1 mb from running 25 reports Memory in use: 1289.0 mb. Used 608.4 mb from running 26 reports Memory in use: 1308.9 mb. Used 628.3 mb from running 27 reports Memory in use: 1328.8 mb. Used 648.2 mb from running 28 reports Memory in use: 1348.8 mb. Used 668.2 mb from running 29 reports Memory in use: 1368.6 mb. Used 688.0 mb from running 30 reports Memory in use: 1389.1 mb. Used 708.5 mb from running 31 reports Memory in use: 1408.3 mb. Used 727.7 mb from running 32 reports After restart, continuing the batch reports Memory in use: 135.5 mb. Used 50.3 mb from running 1 report Memory in use: 145.1 mb. Used 59.8 mb from running 2 reports Memory in use: 167.9 mb. Used 82.6 mb from running 3 reports Memory in use: 187.7 mb. Used 102.5 mb from running 4 reports Memory in use: 207.2 mb. Used 121.9 mb from running 5 reports Memory in use: 226.9 mb. Used 141.6 mb from running 6 reports Memory in use: 246.6 mb. Used 161.3 mb from running 7 reports Memory in use: 273.5 mb. Used 188.2 mb from running 8 reports Memory in use: 294.3 mb. Used 209.1 mb from running 9 reports Memory in use: 315.4 mb. Used 230.2 mb from running 10 reports Memory in use: 334.9 mb. Used 249.6 mb from running 11 reports Memory in use: 356.5 mb. Used 271.3 mb from running 12 reports Memory in use: 376.5 mb. Used 291.2 mb from running 13 reports Memory in use: 397.1 mb. Used 311.8 mb from running 14 reports Memory in use: 417.1 mb. Used 331.9 mb from running 15 reports Memory in use: 437.9 mb. Used 352.6 mb from running 16 reports Memory in use: 457.8 mb. Used 372.5 mb from running 17 reports Memory in use: 477.7 mb. Used 392.4 mb from running 18 reports Memory in use: 497.9 mb. Used 412.6 mb from running 19 reports Memory in use: 518.4 mb. Used 433.1 mb from running 20 reports Memory in use: 537.9 mb. Used 452.7 mb from running 21 reports Memory in use: 559.0 mb. Used 473.7 mb from running 22 reports Memory in use: 578.8 mb. Used 493.5 mb from running 23 reports Memory in use: 599.0 mb. Used 513.8 mb from running 24 reports Memory in use: 619.7 mb. Used 534.4 mb from running 25 reports Memory in use: 640.2 mb. Used 554.9 mb from running 26 reports Memory in use: 660.4 mb. Used 575.1 mb from running 27 reports Memory in use: 680.5 mb. Used 595.2 mb from running 28 reports Memory in use: 700.7 mb. Used 615.4 mb from running 29 reports Memory in use: 720.8 mb. Used 635.5 mb from running 30 reports Memory in use: 741.7 mb. Used 656.4 mb from running 31 reports Memory in use: 761.2 mb. Used 675.9 mb from running 32 reports Memory in use: 781.8 mb. Used 696.5 mb from running 33 reports From bensonforums at gmail.com Sun Jun 7 14:36:50 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sun, 7 Jun 2015 15:36:50 -0400 Subject: [AccessD] How to tell how much resources have been used In-Reply-To: References: Message-ID: Posted in two parts, message too long. On Jun 7, 2015 3:29 PM, "Bill Benson" wrote: > > This gets even more interesting/deeper/troublesome. I started wondering, what was taking up all those resources even BEFORE the reports started being run/outputted. > > Used 0.0 mb by time parameters obtained. > Used 0.2 mb after creating spool table. > Used 110.6 mb after inserting bDoPartnerReportsEast records into spool table. > Used 193.8 mb after inserting bDoPartnerReportsWest records into spool table. > Used 368.2 mb after inserting bDoManagerReportsEast records into spool table. > Used 564.5 mb after inserting bDoManagerReportsWest records into spool table. > > > Wow, between 100 and 200 mb per insertion routine. And it is totally accretive, meaning Access was hanging onto resources with each and every recordset I was opening and populating a table from! > > So I thought maybe I should post for you all the code that I am using for that process, to see if you have any clues what could be making this happen to me? I wouldn't want to give DoCmd.OutputTo acOutputReport, "rptDeliverablePartner", acFormatPDF, strReportPath all of the blame - in fact, per report, it is far the lesser of many evils. > From bensonforums at gmail.com Sun Jun 7 14:37:23 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sun, 7 Jun 2015 15:37:23 -0400 Subject: [AccessD] How to tell how much resources have been used In-Reply-To: References: Message-ID: Code... i hope it all posts. Private Sub cmdCreateReports_Click() Dim Rst As DAO.Recordset Dim SQL As String Dim bContinue As Boolean Dim CurDB As DAO.Database Dim strSQL As String Dim i As Long Dim bDoPartnerReportsAllEast As Boolean, bDoPartnerReportsAllWest As Boolean, bDoManagerReportsAllEast As Boolean, bDoManagerReportsAllWest As Boolean Dim bDoPartnerReportsEast As Boolean, bDoPartnerReportsWest As Boolean, bDoManagerReportsEast As Boolean, bDoManagerReportsWest As Boolean InitialMemoryUsed = GetCurrentProcessMemory Set CurDB = CurrentDb m_strFY = "" If dtBeginSD = "" Or dtEndSD = "" Then MsgBox "Make sure valid beginning and ending sign dates have been entered" Exit Sub End If If Not IsDate(dtBeginSD) Or Not IsDate(dtEndSD) Then MsgBox "Make sure valid beginning and ending sign dates have been entered" Exit Sub End If For i = 0 To lstFY.ListCount - 1 If lstFY.Selected(i) Then m_strFY = lstFY.Column(0, i) Exit For End If Next SaveSetting "PDR", "RuntimeSettings", "LastReportDateBegin", CStr(Me.dtBeginSD) SaveSetting "PDR", "RuntimeSettings", "LastReportDateend", CStr(Me.dtEndSD) g_strBegin = CStr(Me.dtBeginSD) g_strEnd = CStr(Me.dtEndSD) i = 0 For i = 0 To lstReports.ListCount - 1 If lstReports.Selected(i) Then Select Case lstReports.Column(0, i) Case Is = "Deliverables By Partner (All - East)" bDoPartnerReportsAllEast = True Case Is = "Deliverables By Partner (All - West)" bDoPartnerReportsAllWest = True Case Is = "Deliverables By Manager (All - East)" bDoManagerReportsAllEast = True Case Is = "Deliverables By Manager (All - West)" bDoManagerReportsAllWest = True Case Is = "Deliverables By Partner (East)" bDoPartnerReportsEast = True Case Is = "Deliverables By Partner (West)" bDoPartnerReportsWest = True Case Is = "Deliverables By Manager (East)" bDoManagerReportsEast = True Case Is = "Deliverables By Manager (West)" bDoManagerReportsWest = True Case Is = "Compliance By Manager (All - East)" Case Is = "Compliance By Manager (All - West)" Case Is = "Signed Projects Summary (All - East)" Case Is = "Signed Projects Summary (All - West)" End Select End If Next Set CurDB = CurrentDb On Error Resume Next Debug.Print "Used " & Format((GetCurrentProcessMemory - InitialMemoryUsed) / 1024 ^ 2, "0.0") & " mb by time parameters obtained." DoCmd.Close acTable, "TblSpoolReports", acSaveNo DoCmd.DeleteObject acTable, "TblSpoolReports" On Error GoTo 0 CurDB.Execute "CREATE TABLE TblSpoolReports (ID COUNTER, ReportName Text(255), EmployeeID LONG, SignDateBegin DATETIME,SignDateEnd DATETIME,Spooled DATETIME,FY TEXT(10))" Debug.Print "Used " & Format((GetCurrentProcessMemory - InitialMemoryUsed) / 1024 ^ 2, "0.0") & " mb after creating spool table." If bDoPartnerReportsEast Then strSQL = "SELECT DISTINCT B.ID as EmployeeID, B.Name AS [Engagement Partner],B.[First Name] as FirstName, B.Email" strSQL = strSQL & " FROM ([User Information List] AS B INNER JOIN [PDR Tracking] AS A ON B.[ID] = A.[Tax Partner])" strSQL = strSQL & " LEFT JOIN tblCityRegion ON B.City = tblCityRegion.City WHERE tblCityRegion.Region='East'" Set Rst = CurDB.OpenRecordset(strSQL) With Rst While Not .EOF If QualifyingRecords("Partner", "East", Rst.Fields(0).Value) Then CurDB.Execute "Insert Into TblSpoolReports (ReportName,EmployeeID,SignDateBegin,SignDateEnd,FY) Values ('PartnerReportsEast'," & .Fields("EmployeeID").Value & ",#" & g_strBegin & "#,#" & g_strEnd & "#,'" & m_strFY & "')" End If .MoveNext Wend End With Debug.Print "Used " & Format((GetCurrentProcessMemory - InitialMemoryUsed) / 1024 ^ 2, "0.0") & " mb after inserting PartnerReportsEast records into spool table." Rst.Close Set Rst = Nothing End If If bDoPartnerReportsWest Then strSQL = "SELECT DISTINCT B.ID as EmployeeID, B.Name AS [Engagement Partner],B.[First Name] as FirstName, B.Email" strSQL = strSQL & " FROM ([User Information List] AS B INNER JOIN [PDR Tracking] AS A ON B.[ID] = A.[Tax Partner])" strSQL = strSQL & " LEFT JOIN tblCityRegion ON B.City = tblCityRegion.City WHERE tblCityRegion.Region='West'" Set Rst = CurDB.OpenRecordset(strSQL) With Rst While Not .EOF If Rst.Fields(0) = 25 Then Stop If QualifyingRecords("Partner", "West", Rst.Fields(0).Value) Then CurDB.Execute "Insert Into TblSpoolReports (ReportName,EmployeeID,SignDateBegin,SignDateEnd,FY) Values ('PartnerReportsWest'," & .Fields("EmployeeID").Value & ",#" & g_strBegin & "#,#" & g_strEnd & "#,'" & m_strFY & "')" End If .MoveNext Wend End With Rst.Close Set Rst = Nothing Debug.Print "Used " & Format((GetCurrentProcessMemory - InitialMemoryUsed) / 1024 ^ 2, "0.0") & " mb after inserting PartnerReportsWest records into spool table." End If If bDoManagerReportsEast Then strSQL = "SELECT DISTINCT B.ID as EmployeeID, B.Name AS [Engagement Manager], B.[first Name] as FirstName, B.Email" strSQL = strSQL & " FROM ([User Information List] AS B INNER JOIN [PDR Tracking] AS A ON B.[ID] = A.[Tax Manager])" strSQL = strSQL & "LEFT JOIN tblCityRegion ON B.City = tblCityRegion.City WHERE tblCityRegion.Region=""East""" Set Rst = CurDB.OpenRecordset(strSQL) With Rst While Not .EOF If QualifyingRecords("Manager", "East", Rst.Fields(0).Value) Then CurDB.Execute "Insert Into TblSpoolReports (ReportName,EmployeeID,SignDateBegin,SignDateEnd,FY) Values ('ManagerReportsEast'," & .Fields("EmployeeID").Value & ",#" & g_strBegin & "#,#" & g_strEnd & "#,'" & m_strFY & "')" End If .MoveNext Wend End With Rst.Close Set Rst = Nothing Debug.Print "Used " & Format((GetCurrentProcessMemory - InitialMemoryUsed) / 1024 ^ 2, "0.0") & " mb after inserting ManagerReportsEast records into spool table." End If If bDoManagerReportsWest Then strSQL = "SELECT DISTINCT B.ID as EmployeeID, B.Name AS [Engagement Manager], B.[first Name] as FirstName, B.Email" strSQL = strSQL & " FROM ([User Information List] AS B INNER JOIN [PDR Tracking] AS A ON B.[ID] = A.[Tax Manager])" strSQL = strSQL & "LEFT JOIN tblCityRegion ON B.City = tblCityRegion.City WHERE tblCityRegion.Region=""West""" Set Rst = CurDB.OpenRecordset(strSQL) With Rst While Not .EOF If QualifyingRecords("Manager", "West", Rst.Fields(0).Value) Then CurDB.Execute "Insert Into TblSpoolReports (ReportName,EmployeeID,SignDateBegin,SignDateEnd,FY) Values ('ManagerReportsWest'," & .Fields("EmployeeID").Value & ",#" & g_strBegin & "#,#" & g_strEnd & "#,'" & m_strFY & "')" End If .MoveNext Wend End With Rst.Close Set Rst = Nothing Debug.Print "Used " & Format((GetCurrentProcessMemory - InitialMemoryUsed) / 1024 ^ 2, "0.0") & " mb after inserting ManagerReportsWest records into spool table." End If 'Access has already gone from near zero to 563 mb of resource usage as of this point. ... Rest of Sub From edzedz at comcast.net Sun Jun 7 16:29:20 2015 From: edzedz at comcast.net (Edward Zuris) Date: Sun, 7 Jun 2015 15:29:20 -0600 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <016201d0a14b$f6c6b0a0$e45411e0$@net> Message-ID: <201506072129.t57LTQjx003546@databaseadvisors.com> This is interesting as I play with ac2010 from time to time. BTW, is there a compelling reason to go to ac2013 ? -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark Simms Sent: Sunday, June 07, 2015 12:01 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Ac2013 running out of resources Interestingly gang- there was a hot fix for this resource problem for AC-2010. Would it be possible the AC-2013 dev team never incorporated this fix ? BTW:I like that setOption MaxLocks idea.....I'm going to try that. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Sun Jun 7 21:53:35 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sun, 7 Jun 2015 22:53:35 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <201506072129.t57LTQjx003546@databaseadvisors.com> References: <016201d0a14b$f6c6b0a0$e45411e0$@net> <201506072129.t57LTQjx003546@databaseadvisors.com> Message-ID: the only reason I could see is if your clients and end users must use Ac2013 and expect your interface to match their environment. On Sun, Jun 7, 2015 at 5:29 PM, Edward Zuris wrote: > > > This is interesting as I play with ac2010 from time to time. > > BTW, is there a compelling reason to go to ac2013 ? > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] > On Behalf Of Mark Simms > Sent: Sunday, June 07, 2015 12:01 PM > To: 'Access Developers discussion and problem solving' > Subject: Re: [AccessD] Ac2013 running out of resources > > Interestingly gang- there was a hot fix for this resource problem for > AC-2010. > > Would it be possible the AC-2013 dev team never incorporated this fix ? > > BTW:I like that setOption MaxLocks idea.....I'm going to try that. > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From jimdettman at verizon.net Mon Jun 8 07:04:53 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Mon, 08 Jun 2015 08:04:53 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: <016201d0a14b$f6c6b0a0$e45411e0$@net> References: <016201d0a14b$f6c6b0a0$e45411e0$@net> Message-ID: <> If you have Insert, Update, Delete's, you can also set the queries UseTransaction property to no. With that set to no, once JET hits the lock limit, it commits even if it's still executing the query. You can never run out of locks this way. If it's set to yes, then JET will maintain a lock on every record it touches until the query is complete. The default lock limit is only like 9,500 Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark Simms Sent: Sunday, June 07, 2015 02:01 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Ac2013 running out of resources Interestingly gang- there was a hot fix for this resource problem for AC-2010. Would it be possible the AC-2013 dev team never incorporated this fix ? BTW:I like that setOption MaxLocks idea.....I'm going to try that. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From jwelz at hotmail.com Mon Jun 8 11:34:56 2015 From: jwelz at hotmail.com (Jurgen Welz) Date: Mon, 8 Jun 2015 10:34:56 -0600 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: , <06e301d09f27$5bd34de0$1379e9a0$@net>, <5570FEBC.31271.4134939E@stuart.lexacorp.com.pg>, , Message-ID: I'm regularly getting an out of resources message with 2013. Checking resources, I'm rarely over 80 megabytes memory usage when it strikes. The fully decompiled and compacted FE sits at just over 97 megabytes these days. The back end resides on SqlServer 2012 and we connect via ODBC. I rarely encounter the error during code execution and our error logging shows this rarely happens to users. Curiously, it sometimes happens when a single record log table of 3 columns gets updated with a simple execute statement. In my case, it usually bites me when I have a few forms open and then open a table. I haven't been able to pin down the cause, but it is my belief that it may have to do with having a large number of connections to SQL Server open. If I have a particular form open which is rich with combos and subforms, it doesn't take much to put the application over some arbitrary resource limit. If I do a ?Forms("frmName").Controls.Count in the immediate window, it returns 550, many of which are subforms which have their own cumulative hundreds of controls. What I can do is close a few things and the error goes away. I am not limited by memory or processor as these are not stressed at all when I encounter this error. I also know that I'm not bumping into any video resource limitations as it makes no difference whether I'm working on a multi 4K Monitor development environment or whether I dial that down to 1024 by 768 on a single screen in the environment. Access 2003 did not cause me this problem, but then again, there have been subsequent changes in the environment that could bear on the issue. Ciao J?rgen Welz Edmonton, Alberta > From: darryl at whittleconsulting.com.au > To: accessd at databaseadvisors.com > Date: Fri, 5 Jun 2015 03:02:46 +0000 > Subject: Re: [AccessD] Ac2013 running out of resources > > Heh... There is Bill. It is called 'SQL Server Express'. > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson > Sent: Friday, 5 June 2015 12:10 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 running out of resources > > Guys, I sure join in the lament but.... surely there HAS to be a way to not run out of resources. Even if I have to stash the darned data in a remote database (also linked to SharePoint obvously) that I open long enough to run a report in via a auto exec macro and then shut it down... surely there has to be a way to do this? I hate abject failure. > > Would it matter if I ran the reports against a temp table (populated with a consecutive loop of make table queries)? There are seldom more than 30 records per report, as this routine is breaking out project list report by partner - or manager, itdepends on which is called - and no partner has more than 30 projects that is sure. > > I wanted to test the impact of opening the reports in acPreview as David suggested... but dammit, the database stopped being able to connect to Sharepoint url about 8PM. Maybe they brought it down for maintenance. So I couldn't test it. > > I don't mind a kluge at this point. Barring that, asking the user to shut down the database to run all remaining reports (in picking up at whatever point the record set left off by comparing to records in a log table is about all I can come up with here... not likely to endear me with my users. > > Help......... > On Jun 4, 2015 9:44 PM, "Stuart McLachlan" wrote: > > > Typical MS. Every second version is OK. > > > > v 2 OK > > 95 cr*p > > 97 OK > > 2000 cr*p > > 2003 OK > > 2007 cr*p > > 2010 OK > > 2013 cr*p > > 2016 ? > > > > :) > > > > > > On 4 Jun 2015 at 20:34, Mark Simms wrote: > > > > > This is endemic to AC2013. It's all-messed-up. > > > I am constantly getting hung queries as well as "Resources Exceeded" > > > messages. It's really a P.O.C. Almost unusable as a contrast to a > > > darn good 2010 release. > > > > > > Also: I just got an Office 2013 update installed and there was no > > > improvement. > > > > > > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com From marksimms at verizon.net Mon Jun 8 20:42:18 2015 From: marksimms at verizon.net (Mark Simms) Date: Mon, 08 Jun 2015 21:42:18 -0400 Subject: [AccessD] Ac2013 running out of resources In-Reply-To: References: , <06e301d09f27$5bd34de0$1379e9a0$@net>, <5570FEBC.31271.4134939E@stuart.lexacorp.com.pg>, , Message-ID: <026d01d0a255$89043aa0$9b0cafe0$@net> Thanks Jurgen - this totally confirms my suspicions: BUG How much memory can AC-2013 consume ? Try 65 GIGs. Yep...I've seen it in Task Manager. Unbelievable. Another QA debacle by MSFT. Attempt development with AC2013 AT YOUR OWN RISK. From bensonforums at gmail.com Tue Jun 9 09:08:06 2015 From: bensonforums at gmail.com (Bill Benson) Date: Tue, 9 Jun 2015 10:08:06 -0400 Subject: [AccessD] Start Database with batch command and run macros Message-ID: I have a database that because Access runs out of resources, I need to (or I need the user to) shut it down and re-open. The startup form knows to check whether batch reports have completed; if not, to continue generating reports until complete. I think I know how to code a routine to write a batch command to a batch command text file and then Shell that so Access will restart, before quitting user's Access instance. However, if I do that, won't macros be enabled with user prompt just the same as happens now when the user opens the database? I mean, is there a way to force this Access database open from a batch command with macros enabled? TIA From bensonforums at gmail.com Wed Jun 10 09:14:21 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 10 Jun 2015 10:14:21 -0400 Subject: [AccessD] Force selection of multiple records on a datasheet subform Message-ID: I *thought* once back in the day when I was a mentally fit Access programmer, that I had slain this dragon. But maybe it was all a dream. I certainly cannot think of how to do it now. What I have is a list of names and a variety of other details per record, in a data sheet subform. I have conquered the problem of how to record what records are selected when the user leaves the subform to click on an action button elsewhere on the main form (the problem I had there was that when the subform lost focus, so did the knowledge of what records the user had selected - as I say, I solved that be storing the selected items in an array in the Form's MouseMove event). What I now would like to do is ... so as not to confuse the user visually - in the click event of that command button, reselect the records on the subform. Because right now, when the form loses focus, it only seems to show one item selected - assumedly, the last record that was the current record. Any ideas on whether it is possible to force selection of records in the subform? I know I can navigate the recordsetclone set a bookmark and return to a particular record - but I cannot think of a way to force selection of a group of consecutive records. From bensonforums at gmail.com Wed Jun 10 09:51:03 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 10 Jun 2015 10:51:03 -0400 Subject: [AccessD] Force selection of multiple records on a datasheet subform In-Reply-To: References: Message-ID: Dragon Slain! I did it with: Parent form code: Private Sub cmdSendSelected_Click() Dim iTest As Long Dim i As Long, iCount As Long, iFirstSelection As Long, iLastSelection As Long Dim rst As DAO.Recordset Dim FRM As Form Dim F As Form On Error Resume Next iTest = UBound(ArSubformSelections, 2) On Error GoTo 0 If iTest > 0 Then For iTest = 1 To UBound(ArSubformSelections, 2) If Err.Number = 0 Then If Len(CStr(ArSubformSelections(2, iTest))) > 0 Then iCount = iCount + 1 If iCount = 1 Then iFirstSelection = ArSubformSelections(1, iTest) End If iLastSelection = iTest End If End If Next If iFirstSelection > 0 Then Set F = Me.rptFinishedReportsNotYetSent.Form Set rst = F.RecordsetClone rst.FindFirst "Id = " & iFirstSelection If Not rst.NoMatch Then F.Bookmark = rst.Bookmark F.SelHeight = iCount End If If iLastSelection > iLastSelection Then If MsgBox("Send reports for IDs " & ArSubformSelections(1, iFirstSelection) & " through " & ArSubformSelections(1, iLastSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes Then 'Get details of items to send from the array End If Else If MsgBox("Send reports to " & ArSubformSelections(1, iFirstSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes Then 'Get details of items to send from the array End If End If End If End If End Sub Subform code: Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) EstablishSelections End Sub Private Sub EstablishSelections() Dim iHeight As Long Dim i As Long Dim sIDString As String Dim rS As DAO.Recordset iHeight = Me.SelHeight On Error Resume Next If iHeight > 0 Then ReDim ArSubformSelections(1 To 4, 1 To iHeight) sIDString = "" Set rS = Me.RecordsetClone rS.MoveFirst rS.Move Me.SelTop - 1 Else Exit Sub End If For i = 1 To iHeight ArSubformSelections(1, i) = rS![ID] ArSubformSelections(2, i) = rS![EmployeeName] ArSubformSelections(3, i) = rS![EmployeeFirstName] ArSubformSelections(4, i) = rS![Email] sIDString = sIDString & "," & ArSubformSelections(1, i) rS.MoveNext Next If sIDString <> "" Then sIDString = "(" & Mid(sIDString, 2) & ")" End If End Sub Standard Module - public variable declaration dim ArSubformSelections() On Wed, Jun 10, 2015 at 10:14 AM, Bill Benson wrote: > I *thought* once back in the day when I was a mentally fit Access > programmer, that I had slain this dragon. But maybe it was all a dream. I > certainly cannot think of how to do it now. > > What I have is a list of names and a variety of other details per record, > in a data sheet subform. > > I have conquered the problem of how to record what records are selected > when the user leaves the subform to click on an action button elsewhere on > the main form (the problem I had there was that when the subform lost > focus, so did the knowledge of what records the user had selected - as I > say, I solved that be storing the selected items in an array in the Form's > MouseMove event). > > What I now would like to do is ... so as not to confuse the user visually > - in the click event of that command button, reselect the records on the > subform. Because right now, when the form loses focus, it only seems to > show one item selected - assumedly, the last record that was the current > record. > > Any ideas on whether it is possible to force selection of records in the > subform? I know I can navigate the recordsetclone set a bookmark and return > to a particular record - but I cannot think of a way to force selection of > a group of consecutive records. > > > From bensonforums at gmail.com Wed Jun 10 09:53:21 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 10 Jun 2015 10:53:21 -0400 Subject: [AccessD] Force selection of multiple records on a datasheet subform In-Reply-To: References: Message-ID: I think my last post was too long for the list, here it is again just in case. Subform code: Option Compare Database Option Explicit Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) EstablishSelections End Sub Private Sub EstablishSelections() Dim iHeight As Long Dim i As Long Dim sIDString As String Dim rS As DAO.Recordset iHeight = Me.SelHeight On Error Resume Next If iHeight > 0 Then ReDim ArSubformSelections(1 To 4, 1 To iHeight) sIDString = "" Set rS = Me.RecordsetClone rS.MoveFirst rS.Move Me.SelTop - 1 Else Exit Sub End If For i = 1 To iHeight ArSubformSelections(1, i) = rS![ID] ArSubformSelections(2, i) = rS![EmployeeName] ArSubformSelections(3, i) = rS![EmployeeFirstName] ArSubformSelections(4, i) = rS![Email] sIDString = sIDString & "," & ArSubformSelections(1, i) rS.MoveNext Next If sIDString <> "" Then sIDString = "(" & Mid(sIDString, 2) & ")" End If End Sub Parent form Code: Private Sub cmdSendSelected_Click() Dim iTest As Long Dim i As Long, iCount As Long, iFirstSelection As Long, iLastSelection As Long Dim rst As DAO.Recordset Dim FRM As Form Dim F As Form On Error Resume Next iTest = UBound(ArSubformSelections, 2) On Error GoTo 0 If iTest > 0 Then For iTest = 1 To UBound(ArSubformSelections, 2) If Err.Number = 0 Then If Len(CStr(ArSubformSelections(2, iTest))) > 0 Then iCount = iCount + 1 If iCount = 1 Then iFirstSelection = ArSubformSelections(1, iTest) End If iLastSelection = iTest End If End If Next If iFirstSelection > 0 Then Set F = Me.rptFinishedReportsNotYetSent.Form Set rst = F.RecordsetClone rst.FindFirst "Id = " & iFirstSelection If Not rst.NoMatch Then F.Bookmark = rst.Bookmark F.SelHeight = iCount End If If iLastSelection > iLastSelection Then If MsgBox("Send reports for IDs " & ArSubformSelections(1, iFirstSelection) & " through " & ArSubformSelections(1, iLastSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes Then 'Get details of items to send from the array End If Else If MsgBox("Send reports to " & ArSubformSelections(1, iFirstSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes Then 'Get details of items to send from the array End If End If End If End If End Sub Public variable declaration Public ArSubformSelections() From DMcGillivray at ctc.ca.gov Wed Jun 10 10:37:30 2015 From: DMcGillivray at ctc.ca.gov (McGillivray, Don) Date: Wed, 10 Jun 2015 15:37:30 +0000 Subject: [AccessD] Force selection of multiple records on a datasheet subform In-Reply-To: References: Message-ID: Kudos on your success, but your original question raises another for me. I know there are advantages to using a datasheet sub-form (sortable, variable column widths, built-in filtering, etc.) but might a multi-select list box have been an option here? I find it pretty simple to loop through the selected list box items and perform my magic - all while the selected items still appear selected in the list. I've even worked around some of the display limitations by including sorting/filtering options using combo boxes for selecting the target columns/values. I suspect that the overhead of populating/repopulating the list box would be comparable to or lower than that for walking the record set as in your example. Or maybe you have other reasons for using the sub-form? Or other drawbacks to the list box that I'm missing? -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Wednesday, June 10, 2015 7:53 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Force selection of multiple records on a datasheet subform I think my last post was too long for the list, here it is again just in case. Subform code: Option Compare Database Option Explicit Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) EstablishSelections End Sub Private Sub EstablishSelections() Dim iHeight As Long Dim i As Long Dim sIDString As String Dim rS As DAO.Recordset iHeight = Me.SelHeight On Error Resume Next If iHeight > 0 Then ReDim ArSubformSelections(1 To 4, 1 To iHeight) sIDString = "" Set rS = Me.RecordsetClone rS.MoveFirst rS.Move Me.SelTop - 1 Else Exit Sub End If For i = 1 To iHeight ArSubformSelections(1, i) = rS![ID] ArSubformSelections(2, i) = rS![EmployeeName] ArSubformSelections(3, i) = rS![EmployeeFirstName] ArSubformSelections(4, i) = rS![Email] sIDString = sIDString & "," & ArSubformSelections(1, i) rS.MoveNext Next If sIDString <> "" Then sIDString = "(" & Mid(sIDString, 2) & ")" End If End Sub Parent form Code: Private Sub cmdSendSelected_Click() Dim iTest As Long Dim i As Long, iCount As Long, iFirstSelection As Long, iLastSelection As Long Dim rst As DAO.Recordset Dim FRM As Form Dim F As Form On Error Resume Next iTest = UBound(ArSubformSelections, 2) On Error GoTo 0 If iTest > 0 Then For iTest = 1 To UBound(ArSubformSelections, 2) If Err.Number = 0 Then If Len(CStr(ArSubformSelections(2, iTest))) > 0 Then iCount = iCount + 1 If iCount = 1 Then iFirstSelection = ArSubformSelections(1, iTest) End If iLastSelection = iTest End If End If Next If iFirstSelection > 0 Then Set F = Me.rptFinishedReportsNotYetSent.Form Set rst = F.RecordsetClone rst.FindFirst "Id = " & iFirstSelection If Not rst.NoMatch Then F.Bookmark = rst.Bookmark F.SelHeight = iCount End If If iLastSelection > iLastSelection Then If MsgBox("Send reports for IDs " & ArSubformSelections(1, iFirstSelection) & " through " & ArSubformSelections(1, iLastSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes Then 'Get details of items to send from the array End If Else If MsgBox("Send reports to " & ArSubformSelections(1, iFirstSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes Then 'Get details of items to send from the array End If End If End If End If End Sub Public variable declaration Public ArSubformSelections() -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Wed Jun 10 11:13:51 2015 From: bensonforums at gmail.com (Bill Benson) Date: Wed, 10 Jun 2015 12:13:51 -0400 Subject: [AccessD] Force selection of multiple records on a datasheet subform In-Reply-To: References: Message-ID: I just love everything there is about a datasheet subform. The items you mentioned, like ordering, filtering,widening and reordering columns. While there is a drawback in not being able to select non-consecutive items, I handle that by toggling and adjusting filters. Also, I include a column in the underlying table (and thus also in the recordsource query for the subform) called "Selected", and update that through the Select Highlighted Items and UnSelect Highlighted Items command buttons each time the user has highlighted a group of records. Thanks for the kudos, it seems to be working out. On Wed, Jun 10, 2015 at 11:37 AM, McGillivray, Don wrote: > Kudos on your success, but your original question raises another for me. > > I know there are advantages to using a datasheet sub-form (sortable, > variable column widths, built-in filtering, etc.) but might a multi-select > list box have been an option here? I find it pretty simple to loop through > the selected list box items and perform my magic - all while the selected > items still appear selected in the list. I've even worked around some of > the display limitations by including sorting/filtering options using combo > boxes for selecting the target columns/values. I suspect that the overhead > of populating/repopulating the list box would be comparable to or lower > than that for walking the record set as in your example. > > Or maybe you have other reasons for using the sub-form? Or other > drawbacks to the list box that I'm missing? > > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Wednesday, June 10, 2015 7:53 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Force selection of multiple records on a datasheet > subform > > I think my last post was too long for the list, here it is again just in > case. > > Subform code: > > Option Compare Database > Option Explicit > Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As > Single, Y As Single) EstablishSelections End Sub Private Sub > EstablishSelections() Dim iHeight As Long Dim i As Long Dim sIDString As > String Dim rS As DAO.Recordset iHeight = Me.SelHeight On Error Resume Next > If iHeight > 0 Then > ReDim ArSubformSelections(1 To 4, 1 To iHeight) > sIDString = "" > Set rS = Me.RecordsetClone > rS.MoveFirst > rS.Move Me.SelTop - 1 > Else > Exit Sub > End If > For i = 1 To iHeight > ArSubformSelections(1, i) = rS![ID] > ArSubformSelections(2, i) = rS![EmployeeName] > ArSubformSelections(3, i) = rS![EmployeeFirstName] > ArSubformSelections(4, i) = rS![Email] > sIDString = sIDString & "," & ArSubformSelections(1, i) > rS.MoveNext > Next > If sIDString <> "" Then > sIDString = "(" & Mid(sIDString, 2) & ")" > End If > End Sub > > Parent form Code: > > Private Sub cmdSendSelected_Click() > Dim iTest As Long > Dim i As Long, iCount As Long, iFirstSelection As Long, iLastSelection As > Long Dim rst As DAO.Recordset Dim FRM As Form Dim F As Form On Error Resume > Next iTest = UBound(ArSubformSelections, 2) On Error GoTo 0 If iTest > 0 > Then > For iTest = 1 To UBound(ArSubformSelections, 2) > If Err.Number = 0 Then > If Len(CStr(ArSubformSelections(2, iTest))) > 0 Then > iCount = iCount + 1 > If iCount = 1 Then > iFirstSelection = ArSubformSelections(1, iTest) > End If > iLastSelection = iTest > End If > End If > Next > > If iFirstSelection > 0 Then > Set F = Me.rptFinishedReportsNotYetSent.Form > Set rst = F.RecordsetClone > rst.FindFirst "Id = " & iFirstSelection > If Not rst.NoMatch Then > F.Bookmark = rst.Bookmark > F.SelHeight = iCount > End If > > If iLastSelection > iLastSelection Then > If MsgBox("Send reports for IDs " & ArSubformSelections(1, > iFirstSelection) & " through " & ArSubformSelections(1, iLastSelection) & > "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes Then > 'Get details of items to send from the array > End If > Else > If MsgBox("Send reports to " & ArSubformSelections(1, > iFirstSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes > Then > 'Get details of items to send from the array > End If > End If > End If > End If > End Sub > > Public variable declaration > Public ArSubformSelections() > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From darryl at whittleconsulting.com.au Wed Jun 10 17:21:34 2015 From: darryl at whittleconsulting.com.au (Darryl Collins) Date: Wed, 10 Jun 2015 22:21:34 +0000 Subject: [AccessD] Force selection of multiple records on a datasheet subform In-Reply-To: References: Message-ID: Like Don, I am pleased you have a solution - although I would have also used a list box with multi select option set to true. I tend to use them a lot in Access on forms and almost never use subforms, which tend (for me at least) to be cumbersome in their behaviour. Nice work on your solution Bill. Cheers Darryl -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: 11 June 2015 02:14 To: Access Developers discussion and problem solving Subject: Re: [AccessD] Force selection of multiple records on a datasheet subform I just love everything there is about a datasheet subform. The items you mentioned, like ordering, filtering,widening and reordering columns. While there is a drawback in not being able to select non-consecutive items, I handle that by toggling and adjusting filters. Also, I include a column in the underlying table (and thus also in the recordsource query for the subform) called "Selected", and update that through the Select Highlighted Items and UnSelect Highlighted Items command buttons each time the user has highlighted a group of records. Thanks for the kudos, it seems to be working out. On Wed, Jun 10, 2015 at 11:37 AM, McGillivray, Don wrote: > Kudos on your success, but your original question raises another for me. > > I know there are advantages to using a datasheet sub-form (sortable, > variable column widths, built-in filtering, etc.) but might a > multi-select list box have been an option here? I find it pretty > simple to loop through the selected list box items and perform my > magic - all while the selected items still appear selected in the > list. I've even worked around some of the display limitations by > including sorting/filtering options using combo boxes for selecting > the target columns/values. I suspect that the overhead of > populating/repopulating the list box would be comparable to or lower than that for walking the record set as in your example. > > Or maybe you have other reasons for using the sub-form? Or other > drawbacks to the list box that I'm missing? > > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of Bill Benson > Sent: Wednesday, June 10, 2015 7:53 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Force selection of multiple records on a > datasheet subform > > I think my last post was too long for the list, here it is again just > in case. > > Subform code: > > Option Compare Database > Option Explicit > Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As > Single, Y As Single) EstablishSelections End Sub Private Sub > EstablishSelections() Dim iHeight As Long Dim i As Long Dim sIDString > As String Dim rS As DAO.Recordset iHeight = Me.SelHeight On Error > Resume Next If iHeight > 0 Then > ReDim ArSubformSelections(1 To 4, 1 To iHeight) > sIDString = "" > Set rS = Me.RecordsetClone > rS.MoveFirst > rS.Move Me.SelTop - 1 > Else > Exit Sub > End If > For i = 1 To iHeight > ArSubformSelections(1, i) = rS![ID] > ArSubformSelections(2, i) = rS![EmployeeName] > ArSubformSelections(3, i) = rS![EmployeeFirstName] > ArSubformSelections(4, i) = rS![Email] > sIDString = sIDString & "," & ArSubformSelections(1, i) > rS.MoveNext > Next > If sIDString <> "" Then > sIDString = "(" & Mid(sIDString, 2) & ")" > End If > End Sub > > Parent form Code: > > Private Sub cmdSendSelected_Click() > Dim iTest As Long > Dim i As Long, iCount As Long, iFirstSelection As Long, iLastSelection > As Long Dim rst As DAO.Recordset Dim FRM As Form Dim F As Form On > Error Resume Next iTest = UBound(ArSubformSelections, 2) On Error GoTo > 0 If iTest > 0 Then > For iTest = 1 To UBound(ArSubformSelections, 2) > If Err.Number = 0 Then > If Len(CStr(ArSubformSelections(2, iTest))) > 0 Then > iCount = iCount + 1 > If iCount = 1 Then > iFirstSelection = ArSubformSelections(1, iTest) > End If > iLastSelection = iTest > End If > End If > Next > > If iFirstSelection > 0 Then > Set F = Me.rptFinishedReportsNotYetSent.Form > Set rst = F.RecordsetClone > rst.FindFirst "Id = " & iFirstSelection > If Not rst.NoMatch Then > F.Bookmark = rst.Bookmark > F.SelHeight = iCount > End If > > If iLastSelection > iLastSelection Then > If MsgBox("Send reports for IDs " & ArSubformSelections(1, > iFirstSelection) & " through " & ArSubformSelections(1, > iLastSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes Then > 'Get details of items to send from the array > End If > Else > If MsgBox("Send reports to " & ArSubformSelections(1, > iFirstSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = > vbYes Then > 'Get details of items to send from the array > End If > End If > End If > End If > End Sub > > Public variable declaration > Public ArSubformSelections() > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Fri Jun 12 03:02:55 2015 From: bensonforums at gmail.com (Bill Benson) Date: Fri, 12 Jun 2015 04:02:55 -0400 Subject: [AccessD] Force selection of multiple records on a datasheet subform In-Reply-To: References: Message-ID: Hah, very rarely, I get Access to do what I want. The resources issue has really kicked my butt, but I have a painful workaround for that as well. I know this is a different thread but the other one I started is so long lol. I have found though that even when I stop my routine when the current process' s memory hits 1 3GB that (1) I am making an assumption that there were > 1.3 gb to start with, which might be a risky assumption, and (2) I have seen Access run out of resources even before that limit is hit. So, as at least one other commenter mentioned, I don't think available memory is the only manner in which Access runs out of "resources". Despise Access 2013 with utter loathing. On Jun 10, 2015 6:22 PM, "Darryl Collins" wrote: > Like Don, I am pleased you have a solution - although I would have also > used a list box with multi select option set to true. > > I tend to use them a lot in Access on forms and almost never use subforms, > which tend (for me at least) to be cumbersome in their behaviour. > > Nice work on your solution Bill. > > Cheers > Darryl > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: 11 June 2015 02:14 > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Force selection of multiple records on a datasheet > subform > > I just love everything there is about a datasheet subform. The items you > mentioned, like ordering, filtering,widening and reordering columns. > > While there is a drawback in not being able to select non-consecutive > items, I handle that by toggling and adjusting filters. Also, I include a > column in the underlying table (and thus also in the recordsource query for > the subform) called "Selected", and update that through the Select > Highlighted Items and UnSelect Highlighted Items command buttons each time > the user has highlighted a group of records. > > Thanks for the kudos, it seems to be working out. > > On Wed, Jun 10, 2015 at 11:37 AM, McGillivray, Don < > DMcGillivray at ctc.ca.gov> > wrote: > > > Kudos on your success, but your original question raises another for me. > > > > I know there are advantages to using a datasheet sub-form (sortable, > > variable column widths, built-in filtering, etc.) but might a > > multi-select list box have been an option here? I find it pretty > > simple to loop through the selected list box items and perform my > > magic - all while the selected items still appear selected in the > > list. I've even worked around some of the display limitations by > > including sorting/filtering options using combo boxes for selecting > > the target columns/values. I suspect that the overhead of > > populating/repopulating the list box would be comparable to or lower > than that for walking the record set as in your example. > > > > Or maybe you have other reasons for using the sub-form? Or other > > drawbacks to the list box that I'm missing? > > > > > > > > -----Original Message----- > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > > Of Bill Benson > > Sent: Wednesday, June 10, 2015 7:53 AM > > To: Access Developers discussion and problem solving > > Subject: Re: [AccessD] Force selection of multiple records on a > > datasheet subform > > > > I think my last post was too long for the list, here it is again just > > in case. > > > > Subform code: > > > > Option Compare Database > > Option Explicit > > Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As > > Single, Y As Single) EstablishSelections End Sub Private Sub > > EstablishSelections() Dim iHeight As Long Dim i As Long Dim sIDString > > As String Dim rS As DAO.Recordset iHeight = Me.SelHeight On Error > > Resume Next If iHeight > 0 Then > > ReDim ArSubformSelections(1 To 4, 1 To iHeight) > > sIDString = "" > > Set rS = Me.RecordsetClone > > rS.MoveFirst > > rS.Move Me.SelTop - 1 > > Else > > Exit Sub > > End If > > For i = 1 To iHeight > > ArSubformSelections(1, i) = rS![ID] > > ArSubformSelections(2, i) = rS![EmployeeName] > > ArSubformSelections(3, i) = rS![EmployeeFirstName] > > ArSubformSelections(4, i) = rS![Email] > > sIDString = sIDString & "," & ArSubformSelections(1, i) > > rS.MoveNext > > Next > > If sIDString <> "" Then > > sIDString = "(" & Mid(sIDString, 2) & ")" > > End If > > End Sub > > > > Parent form Code: > > > > Private Sub cmdSendSelected_Click() > > Dim iTest As Long > > Dim i As Long, iCount As Long, iFirstSelection As Long, iLastSelection > > As Long Dim rst As DAO.Recordset Dim FRM As Form Dim F As Form On > > Error Resume Next iTest = UBound(ArSubformSelections, 2) On Error GoTo > > 0 If iTest > 0 Then > > For iTest = 1 To UBound(ArSubformSelections, 2) > > If Err.Number = 0 Then > > If Len(CStr(ArSubformSelections(2, iTest))) > 0 Then > > iCount = iCount + 1 > > If iCount = 1 Then > > iFirstSelection = ArSubformSelections(1, iTest) > > End If > > iLastSelection = iTest > > End If > > End If > > Next > > > > If iFirstSelection > 0 Then > > Set F = Me.rptFinishedReportsNotYetSent.Form > > Set rst = F.RecordsetClone > > rst.FindFirst "Id = " & iFirstSelection > > If Not rst.NoMatch Then > > F.Bookmark = rst.Bookmark > > F.SelHeight = iCount > > End If > > > > If iLastSelection > iLastSelection Then > > If MsgBox("Send reports for IDs " & ArSubformSelections(1, > > iFirstSelection) & " through " & ArSubformSelections(1, > > iLastSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes > Then > > 'Get details of items to send from the array > > End If > > Else > > If MsgBox("Send reports to " & ArSubformSelections(1, > > iFirstSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = > > vbYes Then > > 'Get details of items to send from the array > > End If > > End If > > End If > > End If > > End Sub > > > > Public variable declaration > > Public ArSubformSelections() > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Fri Jun 12 03:11:44 2015 From: bensonforums at gmail.com (Bill Benson) Date: Fri, 12 Jun 2015 04:11:44 -0400 Subject: [AccessD] Force selection of multiple records on a datasheet subform In-Reply-To: References: Message-ID: PS. I doubt, Darryl, with several hundred records and many fields which the user needs to see in entirety, should they choose, as well as certain details that they require an ability to copy out of the list (one example is file path) that you would have been satisfied with a listbox. Had I gone that route I would have had to add many textboxes to the form to display full values of any single item clicked on. Also, to allow selection of a range of values I probably would have had to use a multiselect extended list box and added several controls to allow the user reformat and filter and/or sort the columns in the listbox. Another option would be to let the user select from the list box then use opentable or open another datasheet form to display and operate on the selected items from the listbox, which method I have used in other projects. On Jun 10, 2015 6:22 PM, "Darryl Collins" wrote: > Like Don, I am pleased you have a solution - although I would have also > used a list box with multi select option set to true. > > I tend to use them a lot in Access on forms and almost never use subforms, > which tend (for me at least) to be cumbersome in their behaviour. > > Nice work on your solution Bill. > > Cheers > Darryl > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: 11 June 2015 02:14 > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Force selection of multiple records on a datasheet > subform > > I just love everything there is about a datasheet subform. The items you > mentioned, like ordering, filtering,widening and reordering columns. > > While there is a drawback in not being able to select non-consecutive > items, I handle that by toggling and adjusting filters. Also, I include a > column in the underlying table (and thus also in the recordsource query for > the subform) called "Selected", and update that through the Select > Highlighted Items and UnSelect Highlighted Items command buttons each time > the user has highlighted a group of records. > > Thanks for the kudos, it seems to be working out. > > On Wed, Jun 10, 2015 at 11:37 AM, McGillivray, Don < > DMcGillivray at ctc.ca.gov> > wrote: > > > Kudos on your success, but your original question raises another for me. > > > > I know there are advantages to using a datasheet sub-form (sortable, > > variable column widths, built-in filtering, etc.) but might a > > multi-select list box have been an option here? I find it pretty > > simple to loop through the selected list box items and perform my > > magic - all while the selected items still appear selected in the > > list. I've even worked around some of the display limitations by > > including sorting/filtering options using combo boxes for selecting > > the target columns/values. I suspect that the overhead of > > populating/repopulating the list box would be comparable to or lower > than that for walking the record set as in your example. > > > > Or maybe you have other reasons for using the sub-form? Or other > > drawbacks to the list box that I'm missing? > > > > > > > > -----Original Message----- > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > > Of Bill Benson > > Sent: Wednesday, June 10, 2015 7:53 AM > > To: Access Developers discussion and problem solving > > Subject: Re: [AccessD] Force selection of multiple records on a > > datasheet subform > > > > I think my last post was too long for the list, here it is again just > > in case. > > > > Subform code: > > > > Option Compare Database > > Option Explicit > > Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As > > Single, Y As Single) EstablishSelections End Sub Private Sub > > EstablishSelections() Dim iHeight As Long Dim i As Long Dim sIDString > > As String Dim rS As DAO.Recordset iHeight = Me.SelHeight On Error > > Resume Next If iHeight > 0 Then > > ReDim ArSubformSelections(1 To 4, 1 To iHeight) > > sIDString = "" > > Set rS = Me.RecordsetClone > > rS.MoveFirst > > rS.Move Me.SelTop - 1 > > Else > > Exit Sub > > End If > > For i = 1 To iHeight > > ArSubformSelections(1, i) = rS![ID] > > ArSubformSelections(2, i) = rS![EmployeeName] > > ArSubformSelections(3, i) = rS![EmployeeFirstName] > > ArSubformSelections(4, i) = rS![Email] > > sIDString = sIDString & "," & ArSubformSelections(1, i) > > rS.MoveNext > > Next > > If sIDString <> "" Then > > sIDString = "(" & Mid(sIDString, 2) & ")" > > End If > > End Sub > > > > Parent form Code: > > > > Private Sub cmdSendSelected_Click() > > Dim iTest As Long > > Dim i As Long, iCount As Long, iFirstSelection As Long, iLastSelection > > As Long Dim rst As DAO.Recordset Dim FRM As Form Dim F As Form On > > Error Resume Next iTest = UBound(ArSubformSelections, 2) On Error GoTo > > 0 If iTest > 0 Then > > For iTest = 1 To UBound(ArSubformSelections, 2) > > If Err.Number = 0 Then > > If Len(CStr(ArSubformSelections(2, iTest))) > 0 Then > > iCount = iCount + 1 > > If iCount = 1 Then > > iFirstSelection = ArSubformSelections(1, iTest) > > End If > > iLastSelection = iTest > > End If > > End If > > Next > > > > If iFirstSelection > 0 Then > > Set F = Me.rptFinishedReportsNotYetSent.Form > > Set rst = F.RecordsetClone > > rst.FindFirst "Id = " & iFirstSelection > > If Not rst.NoMatch Then > > F.Bookmark = rst.Bookmark > > F.SelHeight = iCount > > End If > > > > If iLastSelection > iLastSelection Then > > If MsgBox("Send reports for IDs " & ArSubformSelections(1, > > iFirstSelection) & " through " & ArSubformSelections(1, > > iLastSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = vbYes > Then > > 'Get details of items to send from the array > > End If > > Else > > If MsgBox("Send reports to " & ArSubformSelections(1, > > iFirstSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = > > vbYes Then > > 'Get details of items to send from the array > > End If > > End If > > End If > > End If > > End Sub > > > > Public variable declaration > > Public ArSubformSelections() > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From darryl at whittleconsulting.com.au Sun Jun 14 18:30:01 2015 From: darryl at whittleconsulting.com.au (Darryl Collins) Date: Sun, 14 Jun 2015 23:30:01 +0000 Subject: [AccessD] Force selection of multiple records on a datasheet subform In-Reply-To: References: Message-ID: Yeah, the best solution really depends on your data and your outcome and your own personal tastes - I would never be so bold as to suggest there is a single best way to do . I like using listboxes (often with a filter option to narrow down the initial options plus using cascading results as well - so as the users selects an option in the first list box, the 2nd list box populates with only valid options based on listbox 1 etc...) but they come with their pro and cons for sure. Anyway, I hear you re Access and it's limits. More and more I am using SQL Server for most things and just use Access as FE if / when required. Good luck. Maybe Access 2016 is better. I was testing it (Access 2016) over the last few weeks, but the latest update to W10 technical preview on the weekend fried my test PC and I have to reinstall it all again from scratch. Too lazy yesterday (Sunday for me) to be bothered with all that, so will try later in the week. Good luck Bill. Cheers Darryl -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Friday, 12 June 2015 6:12 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Force selection of multiple records on a datasheet subform PS. I doubt, Darryl, with several hundred records and many fields which the user needs to see in entirety, should they choose, as well as certain details that they require an ability to copy out of the list (one example is file path) that you would have been satisfied with a listbox. Had I gone that route I would have had to add many textboxes to the form to display full values of any single item clicked on. Also, to allow selection of a range of values I probably would have had to use a multiselect extended list box and added several controls to allow the user reformat and filter and/or sort the columns in the listbox. Another option would be to let the user select from the list box then use opentable or open another datasheet form to display and operate on the selected items from the listbox, which method I have used in other projects. On Jun 10, 2015 6:22 PM, "Darryl Collins" wrote: > Like Don, I am pleased you have a solution - although I would have > also used a list box with multi select option set to true. > > I tend to use them a lot in Access on forms and almost never use > subforms, which tend (for me at least) to be cumbersome in their behaviour. > > Nice work on your solution Bill. > > Cheers > Darryl > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of Bill Benson > Sent: 11 June 2015 02:14 > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Force selection of multiple records on a > datasheet subform > > I just love everything there is about a datasheet subform. The items > you mentioned, like ordering, filtering,widening and reordering columns. > > While there is a drawback in not being able to select non-consecutive > items, I handle that by toggling and adjusting filters. Also, I > include a column in the underlying table (and thus also in the > recordsource query for the subform) called "Selected", and update that > through the Select Highlighted Items and UnSelect Highlighted Items > command buttons each time the user has highlighted a group of records. > > Thanks for the kudos, it seems to be working out. > > On Wed, Jun 10, 2015 at 11:37 AM, McGillivray, Don < > DMcGillivray at ctc.ca.gov> > wrote: > > > Kudos on your success, but your original question raises another for me. > > > > I know there are advantages to using a datasheet sub-form (sortable, > > variable column widths, built-in filtering, etc.) but might a > > multi-select list box have been an option here? I find it pretty > > simple to loop through the selected list box items and perform my > > magic - all while the selected items still appear selected in the > > list. I've even worked around some of the display limitations by > > including sorting/filtering options using combo boxes for selecting > > the target columns/values. I suspect that the overhead of > > populating/repopulating the list box would be comparable to or lower > than that for walking the record set as in your example. > > > > Or maybe you have other reasons for using the sub-form? Or other > > drawbacks to the list box that I'm missing? > > > > > > > > -----Original Message----- > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On > > Behalf Of Bill Benson > > Sent: Wednesday, June 10, 2015 7:53 AM > > To: Access Developers discussion and problem solving > > Subject: Re: [AccessD] Force selection of multiple records on a > > datasheet subform > > > > I think my last post was too long for the list, here it is again > > just in case. > > > > Subform code: > > > > Option Compare Database > > Option Explicit > > Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As > > Single, Y As Single) EstablishSelections End Sub Private Sub > > EstablishSelections() Dim iHeight As Long Dim i As Long Dim > > sIDString As String Dim rS As DAO.Recordset iHeight = Me.SelHeight > > On Error Resume Next If iHeight > 0 Then > > ReDim ArSubformSelections(1 To 4, 1 To iHeight) > > sIDString = "" > > Set rS = Me.RecordsetClone > > rS.MoveFirst > > rS.Move Me.SelTop - 1 > > Else > > Exit Sub > > End If > > For i = 1 To iHeight > > ArSubformSelections(1, i) = rS![ID] > > ArSubformSelections(2, i) = rS![EmployeeName] > > ArSubformSelections(3, i) = rS![EmployeeFirstName] > > ArSubformSelections(4, i) = rS![Email] > > sIDString = sIDString & "," & ArSubformSelections(1, i) > > rS.MoveNext > > Next > > If sIDString <> "" Then > > sIDString = "(" & Mid(sIDString, 2) & ")" > > End If > > End Sub > > > > Parent form Code: > > > > Private Sub cmdSendSelected_Click() > > Dim iTest As Long > > Dim i As Long, iCount As Long, iFirstSelection As Long, > > iLastSelection As Long Dim rst As DAO.Recordset Dim FRM As Form Dim > > F As Form On Error Resume Next iTest = UBound(ArSubformSelections, > > 2) On Error GoTo > > 0 If iTest > 0 Then > > For iTest = 1 To UBound(ArSubformSelections, 2) > > If Err.Number = 0 Then > > If Len(CStr(ArSubformSelections(2, iTest))) > 0 Then > > iCount = iCount + 1 > > If iCount = 1 Then > > iFirstSelection = ArSubformSelections(1, iTest) > > End If > > iLastSelection = iTest > > End If > > End If > > Next > > > > If iFirstSelection > 0 Then > > Set F = Me.rptFinishedReportsNotYetSent.Form > > Set rst = F.RecordsetClone > > rst.FindFirst "Id = " & iFirstSelection > > If Not rst.NoMatch Then > > F.Bookmark = rst.Bookmark > > F.SelHeight = iCount > > End If > > > > If iLastSelection > iLastSelection Then > > If MsgBox("Send reports for IDs " & > > ArSubformSelections(1, > > iFirstSelection) & " through " & ArSubformSelections(1, > > iLastSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = > > vbYes > Then > > 'Get details of items to send from the array > > End If > > Else > > If MsgBox("Send reports to " & ArSubformSelections(1, > > iFirstSelection) & "?", vbQuestion + vbYesNo + vbDefaultButton1) = > > vbYes Then > > 'Get details of items to send from the array > > End If > > End If > > End If > > End If > > End Sub > > > > Public variable declaration > > Public ArSubformSelections() > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From ssharkins at gmail.com Mon Jun 15 11:34:42 2015 From: ssharkins at gmail.com (Susan Harkins) Date: Mon, 15 Jun 2015 12:34:42 -0400 Subject: [AccessD] Calculated Fields Message-ID: Are any of you using the new Calculated Field data type -- I guess it isn't strictly a data type, but I think that's how Access is defining it. Susan H. From Lambert.Heenan at aig.com Mon Jun 15 14:35:20 2015 From: Lambert.Heenan at aig.com (Heenan, Lambert) Date: Mon, 15 Jun 2015 19:35:20 +0000 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: I had not realized that feature was even there. I'm pretty sure I will ignore it and never create such a field, I prefer to do calculations in queries and code where they normally happen and where I expect to look when I have problems to fix. I would hate to spend hours scratching my head only to find that this strange hybrid "data type" was the cause of a problem. There is also no equivalent in Oracle. I wonder if SQL Server has it. Lambert -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins Sent: Monday, June 15, 2015 12:35 PM To: Access Developers discussion and problem solving Subject: [AccessD] Calculated Fields Are any of you using the new Calculated Field data type -- I guess it isn't strictly a data type, but I think that's how Access is defining it. Susan H. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From ssharkins at gmail.com Mon Jun 15 14:42:02 2015 From: ssharkins at gmail.com (Susan Harkins) Date: Mon, 15 Jun 2015 15:42:02 -0400 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: SQL Server has always had calculated fields. Susan H. On Mon, Jun 15, 2015 at 3:35 PM, Heenan, Lambert wrote: > I had not realized that feature was even there. I'm pretty sure I will > ignore it and never create such a field, I prefer to do calculations in > queries and code where they normally happen and where I expect to look when > I have problems to fix. I would hate to spend hours scratching my head only > to find that this strange hybrid "data type" was the cause of a problem. > > There is also no equivalent in Oracle. I wonder if SQL Server has it. > > Lambert > > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Susan Harkins > Sent: Monday, June 15, 2015 12:35 PM > To: Access Developers discussion and problem solving > Subject: [AccessD] Calculated Fields > > Are any of you using the new Calculated Field data type -- I guess it > isn't strictly a data type, but I think that's how Access is defining it. > > Susan H. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From Lambert.Heenan at aig.com Mon Jun 15 15:08:06 2015 From: Lambert.Heenan at aig.com (Heenan, Lambert) Date: Mon, 15 Jun 2015 20:08:06 +0000 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: Interesting. Still don't like the whole idea though. :-) Lambert -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins Sent: Monday, June 15, 2015 3:42 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Calculated Fields SQL Server has always had calculated fields. Susan H. On Mon, Jun 15, 2015 at 3:35 PM, Heenan, Lambert wrote: > I had not realized that feature was even there. I'm pretty sure I will > ignore it and never create such a field, I prefer to do calculations > in queries and code where they normally happen and where I expect to > look when I have problems to fix. I would hate to spend hours > scratching my head only to find that this strange hybrid "data type" was the cause of a problem. > > There is also no equivalent in Oracle. I wonder if SQL Server has it. > > Lambert > > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of Susan Harkins > Sent: Monday, June 15, 2015 12:35 PM > To: Access Developers discussion and problem solving > Subject: [AccessD] Calculated Fields > > Are any of you using the new Calculated Field data type -- I guess it > isn't strictly a data type, but I think that's how Access is defining it. > > Susan H. > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From charlotte.foust at gmail.com Mon Jun 15 17:36:56 2015 From: charlotte.foust at gmail.com (Charlotte Foust) Date: Mon, 15 Jun 2015 15:36:56 -0700 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: SQL Server had triggers too, while Access only just acquired data macros to serve some of the same purposes. I haven't used them in Access or SQL Server because to me they totally violate normalization. They're really data warehousing/reporting tools that have been grafted onto databases and in Access they can be easily misused by people who don't know how to program events. Their use in Access is, I think, aimed at web-based solutions. Charlotte Foust (916) 206-4336 On Mon, Jun 15, 2015 at 12:42 PM, Susan Harkins wrote: > SQL Server has always had calculated fields. > > Susan H. > > On Mon, Jun 15, 2015 at 3:35 PM, Heenan, Lambert > wrote: > > > I had not realized that feature was even there. I'm pretty sure I will > > ignore it and never create such a field, I prefer to do calculations in > > queries and code where they normally happen and where I expect to look > when > > I have problems to fix. I would hate to spend hours scratching my head > only > > to find that this strange hybrid "data type" was the cause of a problem. > > > > There is also no equivalent in Oracle. I wonder if SQL Server has it. > > > > Lambert > > > > > > > > -----Original Message----- > > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > > Susan Harkins > > Sent: Monday, June 15, 2015 12:35 PM > > To: Access Developers discussion and problem solving > > Subject: [AccessD] Calculated Fields > > > > Are any of you using the new Calculated Field data type -- I guess it > > isn't strictly a data type, but I think that's how Access is defining it. > > > > Susan H. > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From ssharkins at gmail.com Mon Jun 15 17:51:54 2015 From: ssharkins at gmail.com (Susan Harkins) Date: Mon, 15 Jun 2015 18:51:54 -0400 Subject: [AccessD] Calculated Fields Message-ID: Good information -- can you expound? Not necessary, but I'm interested in following this comment. Susan H. Their use in Access is, I think, aimed at web-based > solutions. > > From charlotte.foust at gmail.com Mon Jun 15 17:59:23 2015 From: charlotte.foust at gmail.com (Charlotte Foust) Date: Mon, 15 Jun 2015 15:59:23 -0700 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: Web-based solutions are really what data macros were created for, to replace the VBA and Access macros that don't work on the web. I've been hearing this from MVPs for some time but I can't point to a particular article. Data macros can be very powerful but, like triggers, they can be used inappropriately too. I tend to use them to put date/time and user ID into records automagically, but I don't use them to update a totals value. I don't think they work across tables, either, which triggers can. Charlotte Foust (916) 206-4336 On Mon, Jun 15, 2015 at 3:51 PM, Susan Harkins wrote: > Good information -- can you expound? Not necessary, but I'm interested in > following this comment. > > Susan H. > > Their use in Access is, I think, aimed at web-based > > solutions. > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From ssharkins at gmail.com Mon Jun 15 18:40:59 2015 From: ssharkins at gmail.com (Susan Harkins) Date: Mon, 15 Jun 2015 19:40:59 -0400 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: So, you think calculated fields are of the same ilk? A column that updates while someone's updating a table via a web app? Susan H. On Mon, Jun 15, 2015 at 6:59 PM, Charlotte Foust wrote: > Web-based solutions are really what data macros were created for, to > replace the VBA and Access macros that don't work on the web. I've been > hearing this from MVPs for some time but I can't point to a particular > article. > > Data macros can be very powerful but, like triggers, they can be used > inappropriately too. I tend to use them to put date/time and user ID into > records automagically, but I don't use them to update a totals value. I > don't think they work across tables, either, which triggers can. > > Charlotte Foust > (916) 206-4336 > > On Mon, Jun 15, 2015 at 3:51 PM, Susan Harkins > wrote: > > > Good information -- can you expound? Not necessary, but I'm interested in > > following this comment. > > > > Susan H. > > > > Their use in Access is, I think, aimed at web-based > > > solutions. > > > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From charlotte.foust at gmail.com Mon Jun 15 18:58:40 2015 From: charlotte.foust at gmail.com (Charlotte Foust) Date: Mon, 15 Jun 2015 16:58:40 -0700 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: I haven't built a web app, so I can't speak from experience. That's my perception of them, but I haven't used them so don't count on my uninformed opinion. I do know I haven't seen one used in any of the pro apps I seen presented at conferences, etc. Charlotte Foust (916) 206-4336 On Mon, Jun 15, 2015 at 4:40 PM, Susan Harkins wrote: > So, you think calculated fields are of the same ilk? A column that updates > while someone's updating a table via a web app? > > Susan H. > > On Mon, Jun 15, 2015 at 6:59 PM, Charlotte Foust < > charlotte.foust at gmail.com> > wrote: > > > Web-based solutions are really what data macros were created for, to > > replace the VBA and Access macros that don't work on the web. I've been > > hearing this from MVPs for some time but I can't point to a particular > > article. > > > > Data macros can be very powerful but, like triggers, they can be used > > inappropriately too. I tend to use them to put date/time and user ID > into > > records automagically, but I don't use them to update a totals value. I > > don't think they work across tables, either, which triggers can. > > > > Charlotte Foust > > (916) 206-4336 > > > > On Mon, Jun 15, 2015 at 3:51 PM, Susan Harkins > > wrote: > > > > > Good information -- can you expound? Not necessary, but I'm interested > in > > > following this comment. > > > > > > Susan H. > > > > > > Their use in Access is, I think, aimed at web-based > > > > solutions. > > > > > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From charlotte.foust at gmail.com Mon Jun 15 19:00:58 2015 From: charlotte.foust at gmail.com (Charlotte Foust) Date: Mon, 15 Jun 2015 17:00:58 -0700 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: Maybe you could write on the pros and cons of using such a thing. How would you decide that they would be appropriate rather than dangerous. My thought is always what happens if it fails? Do you just get a big error message, is it silent, or what? If they raise a trappable error, where would you trap it? Charlotte Foust (916) 206-4336 On Mon, Jun 15, 2015 at 4:40 PM, Susan Harkins wrote: > So, you think calculated fields are of the same ilk? A column that updates > while someone's updating a table via a web app? > > Susan H. > > On Mon, Jun 15, 2015 at 6:59 PM, Charlotte Foust < > charlotte.foust at gmail.com> > wrote: > > > Web-based solutions are really what data macros were created for, to > > replace the VBA and Access macros that don't work on the web. I've been > > hearing this from MVPs for some time but I can't point to a particular > > article. > > > > Data macros can be very powerful but, like triggers, they can be used > > inappropriately too. I tend to use them to put date/time and user ID > into > > records automagically, but I don't use them to update a totals value. I > > don't think they work across tables, either, which triggers can. > > > > Charlotte Foust > > (916) 206-4336 > > > > On Mon, Jun 15, 2015 at 3:51 PM, Susan Harkins > > wrote: > > > > > Good information -- can you expound? Not necessary, but I'm interested > in > > > following this comment. > > > > > > Susan H. > > > > > > Their use in Access is, I think, aimed at web-based > > > > solutions. > > > > > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From ssharkins at gmail.com Mon Jun 15 20:54:29 2015 From: ssharkins at gmail.com (Susan Harkins) Date: Mon, 15 Jun 2015 21:54:29 -0400 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: Well, with enough research and insight I could write about them, but without the practical experience, I'm not sure I could offer much of an opinion! ;) Susan H. On Mon, Jun 15, 2015 at 8:00 PM, Charlotte Foust wrote: > Maybe you could write on the pros and cons of using such a thing. How > would you decide that they would be appropriate rather than dangerous. My > thought is always what happens if it fails? Do you just get a big error > message, is it silent, or what? If they raise a trappable error, where > would you trap it? > > Charlotte Foust > (916) 206-4336 > > On Mon, Jun 15, 2015 at 4:40 PM, Susan Harkins > wrote: > > > So, you think calculated fields are of the same ilk? A column that > updates > > while someone's updating a table via a web app? > > > > Susan H. > > > > On Mon, Jun 15, 2015 at 6:59 PM, Charlotte Foust < > > charlotte.foust at gmail.com> > > wrote: > > > > > Web-based solutions are really what data macros were created for, to > > > replace the VBA and Access macros that don't work on the web. I've > been > > > hearing this from MVPs for some time but I can't point to a particular > > > article. > > > > > > Data macros can be very powerful but, like triggers, they can be used > > > inappropriately too. I tend to use them to put date/time and user ID > > into > > > records automagically, but I don't use them to update a totals value. > I > > > don't think they work across tables, either, which triggers can. > > > > > > Charlotte Foust > > > (916) 206-4336 > > > > > > On Mon, Jun 15, 2015 at 3:51 PM, Susan Harkins > > > wrote: > > > > > > > Good information -- can you expound? Not necessary, but I'm > interested > > in > > > > following this comment. > > > > > > > > Susan H. > > > > > > > > Their use in Access is, I think, aimed at web-based > > > > > solutions. > > > > > > > > > > > > > > -- > > > > AccessD mailing list > > > > AccessD at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > Website: http://www.databaseadvisors.com > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From stuart at lexacorp.com.pg Mon Jun 15 21:33:11 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Tue, 16 Jun 2015 12:33:11 +1000 Subject: [AccessD] Calculated Fields In-Reply-To: References: , , Message-ID: <557F8AE7.4849.200FFF4D@stuart.lexacorp.com.pg> >From https://msdn.microsoft.com/en-us/library/office/ff945943%28v=office.14%29.aspx "There are those who would argue that adding calculated fields in a table violates rules of normalization, and in some cases, they are right. In some cases, it is worth breaking the rules: If you know that you will need the calculation in every object based on the table, if you know that the expression cannot change over time, or if having the calculation in the table would make your data clearer, then use the feature. You can always, as in Access 2003 or Access 2007, include calculations in queries, also. Doing so requires you to base all forms and reports on the query, instead of on the table-end-users may miss this important point, so if end-users are creating their own forms and reports, it is best to consider using calculated fields in tables. Be aware that calculated fields cannot call user-defined functions, only built-in functions. In addition, you must supply all parameters for methods that you call, even if the parameters are optional. If you use calculated fields, be aware that earlier versions of Access will be unable to open the table-verify that you will need the table only in Access 2010 before you use this new feature." -- Stuart On 15 Jun 2015 at 16:58, Charlotte Foust wrote: > I haven't built a web app, so I can't speak from experience. That's > my perception of them, but I haven't used them so don't count on my > uninformed opinion. I do know I haven't seen one used in any of the > pro apps I seen presented at conferences, etc. > > Charlotte Foust > (916) 206-4336 > > On Mon, Jun 15, 2015 at 4:40 PM, Susan Harkins > wrote: > > > So, you think calculated fields are of the same ilk? A column that > > updates while someone's updating a table via a web app? > > > > Susan H. > > > > On Mon, Jun 15, 2015 at 6:59 PM, Charlotte Foust < > > charlotte.foust at gmail.com> > > wrote: > > > > > Web-based solutions are really what data macros were created for, > > > to replace the VBA and Access macros that don't work on the web. > > > I've been hearing this from MVPs for some time but I can't point > > > to a particular article. > > > > > > Data macros can be very powerful but, like triggers, they can be > > > used inappropriately too. I tend to use them to put date/time and > > > user ID > > into > > > records automagically, but I don't use them to update a totals > > > value. I don't think they work across tables, either, which > > > triggers can. > > > > > > Charlotte Foust > > > (916) 206-4336 > > > > > > On Mon, Jun 15, 2015 at 3:51 PM, Susan Harkins > > > wrote: > > > > > > > Good information -- can you expound? Not necessary, but I'm > > > > interested > > in > > > > following this comment. > > > > > > > > Susan H. > > > > > > > > Their use in Access is, I think, aimed at web-based > > > > > solutions. > > > > > > > > > > > > > > -- > > > > AccessD mailing list > > > > AccessD at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > > Website: http://www.databaseadvisors.com > > > > > > > -- > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From jimdettman at verizon.net Tue Jun 16 07:57:28 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Tue, 16 Jun 2015 08:57:28 -0400 Subject: [AccessD] Calculated Fields In-Reply-To: References: Message-ID: <244069A15C6E4BB3831AED948994028B@XPS> Fundamentally yes. Anything that has been added to Access since 2007 has been done with web apps in mind. But also a secondary objective has been taking Access "back to it's roots"; which is a tool meant for the power end user. Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins Sent: Monday, June 15, 2015 07:41 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Calculated Fields So, you think calculated fields are of the same ilk? A column that updates while someone's updating a table via a web app? Susan H. On Mon, Jun 15, 2015 at 6:59 PM, Charlotte Foust wrote: > Web-based solutions are really what data macros were created for, to > replace the VBA and Access macros that don't work on the web. I've been > hearing this from MVPs for some time but I can't point to a particular > article. > > Data macros can be very powerful but, like triggers, they can be used > inappropriately too. I tend to use them to put date/time and user ID into > records automagically, but I don't use them to update a totals value. I > don't think they work across tables, either, which triggers can. > > Charlotte Foust > (916) 206-4336 > > On Mon, Jun 15, 2015 at 3:51 PM, Susan Harkins > wrote: > > > Good information -- can you expound? Not necessary, but I'm interested in > > following this comment. > > > > Susan H. > > > > Their use in Access is, I think, aimed at web-based > > > solutions. > > > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From Salato at ky.gov Tue Jun 16 08:26:47 2015 From: Salato at ky.gov (FW Salato Center) Date: Tue, 16 Jun 2015 13:26:47 +0000 Subject: [AccessD] Calculated Fields In-Reply-To: <244069A15C6E4BB3831AED948994028B@XPS> References: <244069A15C6E4BB3831AED948994028B@XPS> Message-ID: Well, I can see its place then. Susan H. Fundamentally yes. Anything that has been added to Access since 2007 has been done with web apps in mind. But also a secondary objective has been taking Access "back to it's roots"; which is a tool meant for the power end user. Jim. So, you think calculated fields are of the same ilk? A column that updates while someone's updating a table via a web app? Susan H. From bensonforums at gmail.com Tue Jun 16 08:53:44 2015 From: bensonforums at gmail.com (Bill Benson) Date: Tue, 16 Jun 2015 09:53:44 -0400 Subject: [AccessD] Command to save the database Message-ID: I have been burned WAY too many times saving a database and then realizing something was not quite right, and not having a backup, screwed-ville. So, I wrote a routine to create a backup of the database in its original condition. What I want to add to this is a step to actually save the database without having to press Ctrl-S. The only thing I can find without resorting to SendKeys is the DoCmd.Save method, but this appears (to me) to apply to objects, rather than the full database? Am I right about that - and more to the point, is there a command to save the database? TIA From bensonforums at gmail.com Tue Jun 16 09:19:29 2015 From: bensonforums at gmail.com (Bill Benson) Date: Tue, 16 Jun 2015 10:19:29 -0400 Subject: [AccessD] Command to save the database In-Reply-To: References: Message-ID: Found what I was looking for. RunCommand acCmdSave Here is the completed routine; If you use a startup form (or open another invisible form from code on your current startup form), and run this routine from a timer, I think it is safe to say one has a pretty robust backup routine, which is useful to a developer. Probably not something to keep in place for runtime versions or in situations where the database is very large. If someone sees anything to modify, that would be helpful - thanks again. Sub SaveMe() Dim objFSO As Object Dim objFSOFolder As Object Dim strThisApp As String Dim iSpace As Long Dim iNumeric As Long Dim TheMax As Long Dim strLookForNumeric As String Dim FIL As Object Dim strStartText As String Dim strPath As String strThisApp = Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, "\") + 1) strThisApp = Left(strThisApp, InStrRev(strThisApp, ".") - 1) Set objFSO = New FileSystemObject strPath = Environ("USERPROFILE") & "\My Documents" On Error Resume Next Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & strThisApp) If objFSOFolder Is Nothing Then Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & strThisApp) If objFSOFolder Is Nothing Then Set objFSOFolder = objFSO.CreateFolder(strPath & "\Backups for " & strThisApp) End If End If For Each FIL In objFSOFolder.Files If InStr(FIL.Name, "Backup No ") > 0 And InStr(FIL.Name, strThisApp) > 0 Then strStartText = Mid(FIL.Name, Len("Backup No ") + 1) iSpace = InStr(strStartText, Chr(32)) strLookForNumeric = Left(strStartText, iSpace - 1) On Error Resume Next iNumeric = CLng(strLookForNumeric) If iNumeric > TheMax Then TheMax = iNumeric End If End If Next objFSO.CopyFile CurrentDb.Name, objFSOFolder.Path & "\Backup No " & Format(TheMax + 1, "0000") & " " & strThisApp & Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, ".")) RunCommand acCmdSave End Sub On Tue, Jun 16, 2015 at 9:53 AM, Bill Benson wrote: > I have been burned WAY too many times saving a database and then realizing > something was not quite right, and not having a backup, screwed-ville. > > So, I wrote a routine to create a backup of the database in its original > condition. > > What I want to add to this is a step to actually save the database without > having to press Ctrl-S. > > The only thing I can find without resorting to SendKeys is the DoCmd.Save > method, but this appears (to me) to apply to objects, rather than the full > database? Am I right about that - and more to the point, is there a command > to save the database? > > TIA > From bensonforums at gmail.com Tue Jun 16 09:37:12 2015 From: bensonforums at gmail.com (Bill Benson) Date: Tue, 16 Jun 2015 10:37:12 -0400 Subject: [AccessD] Command to save the database In-Reply-To: References: Message-ID: ok, I still need some help - please. I have been thwarted (temporarily I hope) by two conditions. I put this code in a form that I want to open on startup. I am getting an overflow error, I presume because the value in miliseconds is too high a number. However, how else can I make the event occur only at 10 minute intervals? Secondly, when the database opens up, the AutoExec which calls my function to open the frmSaveMe form invisibly runs PRIOR to the UI giving the option to Enable content, and throws up a dialog in which the only response appears to be "Stop All Macros". Kinda defeats the purpose of an AutoExec. There is only one step in the macro, it is RunCode LaunchSaveMe(). How can I make this macro warning go away, and simply run - preferably after Content has been enabled? Private Sub Form_Load() SaveMe Me.TimerInterval = 1000 * 60 * 10 End Sub Private Sub Form_Timer() SaveMe End Sub 'Standard module: Sub SaveMe() Dim objFSO As Object Dim objFSOFolder As Object Dim strThisApp As String Dim iSpace As Long Dim iNumeric As Long Dim TheMax As Long Dim strLookForNumeric As String Dim FIL As Object Dim strStartText As String Dim strPath As String strThisApp = Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, "\") + 1) strThisApp = Left(strThisApp, InStrRev(strThisApp, ".") - 1) Set objFSO = New FileSystemObject strPath = Environ("USERPROFILE") & "\My Documents" On Error Resume Next Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & strThisApp) If objFSOFolder Is Nothing Then Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & strThisApp) If objFSOFolder Is Nothing Then Set objFSOFolder = objFSO.CreateFolder(strPath & "\Backups for " & strThisApp) End If End If For Each FIL In objFSOFolder.Files If InStr(FIL.Name, "Backup No ") > 0 And InStr(FIL.Name, strThisApp) > 0 Then strStartText = Mid(FIL.Name, Len("Backup No ") + 1) iSpace = InStr(strStartText, Chr(32)) strLookForNumeric = Left(strStartText, iSpace - 1) On Error Resume Next iNumeric = CLng(strLookForNumeric) If iNumeric > TheMax Then TheMax = iNumeric End If End If Next objFSO.CopyFile CurrentDb.Name, objFSOFolder.Path & "\Backup No " & Format(TheMax + 1, "0000") & " " & strThisApp & Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, ".")) RunCommand acCmdSave End Sub Function LaunchSaveMe() On Error Resume Next DoCmd.Close acForm, "FrmSaveMe", acSaveNo DoCmd.OpenForm "frmsaveme", acNormal, , , , acHidden End Function From gustav at cactus.dk Tue Jun 16 10:10:13 2015 From: gustav at cactus.dk (Gustav Brock) Date: Tue, 16 Jun 2015 15:10:13 +0000 Subject: [AccessD] Command to save the database Message-ID: Hi Bill Numbers default to Integer. Specify Long: Me.TimerInterval = 1000& * 60& * 10& Don't know about your macro issue ... /gustav -----Oprindelig meddelelse----- Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] P? vegne af Bill Benson Sendt: 16. juni 2015 16:37 Til: Access Developers discussion and problem solving Emne: Re: [AccessD] Command to save the database ok, I still need some help - please. I have been thwarted (temporarily I hope) by two conditions. I put this code in a form that I want to open on startup. I am getting an overflow error, I presume because the value in miliseconds is too high a number. However, how else can I make the event occur only at 10 minute intervals? Secondly, when the database opens up, the AutoExec which calls my function to open the frmSaveMe form invisibly runs PRIOR to the UI giving the option to Enable content, and throws up a dialog in which the only response appears to be "Stop All Macros". Kinda defeats the purpose of an AutoExec. There is only one step in the macro, it is RunCode LaunchSaveMe(). How can I make this macro warning go away, and simply run - preferably after Content has been enabled? Private Sub Form_Load() SaveMe Me.TimerInterval = 1000 * 60 * 10 End Sub Private Sub Form_Timer() SaveMe End Sub 'Standard module: Sub SaveMe() Dim objFSO As Object Dim objFSOFolder As Object Dim strThisApp As String Dim iSpace As Long Dim iNumeric As Long Dim TheMax As Long Dim strLookForNumeric As String Dim FIL As Object Dim strStartText As String Dim strPath As String strThisApp = Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, "\") + 1) strThisApp = Left(strThisApp, InStrRev(strThisApp, ".") - 1) Set objFSO = New FileSystemObject strPath = Environ("USERPROFILE") & "\My Documents" On Error Resume Next Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & strThisApp) If objFSOFolder Is Nothing Then Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & strThisApp) If objFSOFolder Is Nothing Then Set objFSOFolder = objFSO.CreateFolder(strPath & "\Backups for " & strThisApp) End If End If For Each FIL In objFSOFolder.Files If InStr(FIL.Name, "Backup No ") > 0 And InStr(FIL.Name, strThisApp) > 0 Then strStartText = Mid(FIL.Name, Len("Backup No ") + 1) iSpace = InStr(strStartText, Chr(32)) strLookForNumeric = Left(strStartText, iSpace - 1) On Error Resume Next iNumeric = CLng(strLookForNumeric) If iNumeric > TheMax Then TheMax = iNumeric End If End If Next objFSO.CopyFile CurrentDb.Name, objFSOFolder.Path & "\Backup No " & Format(TheMax + 1, "0000") & " " & strThisApp & Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, ".")) RunCommand acCmdSave End Sub Function LaunchSaveMe() On Error Resume Next DoCmd.Close acForm, "FrmSaveMe", acSaveNo DoCmd.OpenForm "frmsaveme", acNormal, , , , acHidden End Function From bensonforums at gmail.com Tue Jun 16 10:16:50 2015 From: bensonforums at gmail.com (Bill Benson) Date: Tue, 16 Jun 2015 11:16:50 -0400 Subject: [AccessD] Command to save the database In-Reply-To: References: Message-ID: Thanks, good to know!!!!!!!!!!!!!!!!!!!!!!!! On Tue, Jun 16, 2015 at 11:10 AM, Gustav Brock wrote: > Hi Bill > > Numbers default to Integer. Specify Long: > > Me.TimerInterval = 1000& * 60& * 10& > > Don't know about your macro issue ... > > /gustav > > -----Oprindelig meddelelse----- > Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] P? vegne af > Bill Benson > Sendt: 16. juni 2015 16:37 > Til: Access Developers discussion and problem solving > Emne: Re: [AccessD] Command to save the database > > ok, I still need some help - please. > > I have been thwarted (temporarily I hope) by two conditions. > > I put this code in a form that I want to open on startup. I am getting an > overflow error, I presume because the value in miliseconds is too high a > number. However, how else can I make the event occur only at 10 minute > intervals? > > Secondly, when the database opens up, the AutoExec which calls my function > to open the frmSaveMe form invisibly runs PRIOR to the UI giving the option > to Enable content, and throws up a dialog in which the only response > appears to be "Stop All Macros". Kinda defeats the purpose of an AutoExec. > > There is only one step in the macro, it is RunCode LaunchSaveMe(). > > How can I make this macro warning go away, and simply run - preferably > after Content has been enabled? > > Private Sub Form_Load() > SaveMe > Me.TimerInterval = 1000 * 60 * 10 > End Sub > > > Private Sub Form_Timer() > SaveMe > End Sub > > 'Standard module: > > Sub SaveMe() > Dim objFSO As Object > Dim objFSOFolder As Object > Dim strThisApp As String > Dim iSpace As Long > Dim iNumeric As Long > Dim TheMax As Long > Dim strLookForNumeric As String > Dim FIL As Object > Dim strStartText As String > Dim strPath As String > strThisApp = Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, "\") + 1) > strThisApp = Left(strThisApp, InStrRev(strThisApp, ".") - 1) Set objFSO = > New FileSystemObject strPath = Environ("USERPROFILE") & "\My Documents" > On Error Resume Next > Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & > strThisApp) If objFSOFolder Is Nothing Then > Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & > strThisApp) > If objFSOFolder Is Nothing Then > Set objFSOFolder = objFSO.CreateFolder(strPath & "\Backups for " & > strThisApp) > End If > End If > For Each FIL In objFSOFolder.Files > If InStr(FIL.Name, "Backup No ") > 0 And InStr(FIL.Name, strThisApp) > > 0 Then > strStartText = Mid(FIL.Name, Len("Backup No ") + 1) > iSpace = InStr(strStartText, Chr(32)) > strLookForNumeric = Left(strStartText, iSpace - 1) > On Error Resume Next > iNumeric = CLng(strLookForNumeric) > If iNumeric > TheMax Then > TheMax = iNumeric > End If > End If > Next > objFSO.CopyFile CurrentDb.Name, objFSOFolder.Path & "\Backup No " & > Format(TheMax + 1, "0000") & " " & strThisApp & Mid(CurrentDb.Name, > InStrRev(CurrentDb.Name, ".")) RunCommand acCmdSave End Sub Function > LaunchSaveMe() On Error Resume Next DoCmd.Close acForm, "FrmSaveMe", > acSaveNo DoCmd.OpenForm "frmsaveme", acNormal, , , , acHidden > End Function > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From tinanfields at torchlake.com Tue Jun 16 13:25:27 2015 From: tinanfields at torchlake.com (Tina Norris Fields) Date: Tue, 16 Jun 2015 14:25:27 -0400 Subject: [AccessD] Command to save the database In-Reply-To: References: Message-ID: <55806A17.9020904@torchlake.com> Hi Bill, Sorry if I've just misunderstood, but, wouldn't you want to set the macro settings to enable, so that the option to enable content never comes up at all? TNF Tina Norris Fields tinanfields-at-torchlake-dot-com 231-322-2787 On 06/16/15 10:37 AM, Bill Benson wrote: > ok, I still need some help - please. > > I have been thwarted (temporarily I hope) by two conditions. > > I put this code in a form that I want to open on startup. I am getting an > overflow error, I presume because the value in miliseconds is too high a > number. However, how else can I make the event occur only at 10 minute > intervals? > > Secondly, when the database opens up, the AutoExec which calls my function > to open the frmSaveMe form invisibly runs PRIOR to the UI giving the option > to Enable content, and throws up a dialog in which the only response > appears to be "Stop All Macros". Kinda defeats the purpose of an AutoExec. > > There is only one step in the macro, it is RunCode LaunchSaveMe(). > > How can I make this macro warning go away, and simply run - preferably > after Content has been enabled? > > Private Sub Form_Load() > SaveMe > Me.TimerInterval = 1000 * 60 * 10 > End Sub > > > Private Sub Form_Timer() > SaveMe > End Sub > > 'Standard module: > > Sub SaveMe() > Dim objFSO As Object > Dim objFSOFolder As Object > Dim strThisApp As String > Dim iSpace As Long > Dim iNumeric As Long > Dim TheMax As Long > Dim strLookForNumeric As String > Dim FIL As Object > Dim strStartText As String > Dim strPath As String > strThisApp = Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, "\") + 1) > strThisApp = Left(strThisApp, InStrRev(strThisApp, ".") - 1) > Set objFSO = New FileSystemObject > strPath = Environ("USERPROFILE") & "\My Documents" > On Error Resume Next > Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & strThisApp) > If objFSOFolder Is Nothing Then > Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & > strThisApp) > If objFSOFolder Is Nothing Then > Set objFSOFolder = objFSO.CreateFolder(strPath & "\Backups for " & > strThisApp) > End If > End If > For Each FIL In objFSOFolder.Files > If InStr(FIL.Name, "Backup No ") > 0 And InStr(FIL.Name, strThisApp) > > 0 Then > strStartText = Mid(FIL.Name, Len("Backup No ") + 1) > iSpace = InStr(strStartText, Chr(32)) > strLookForNumeric = Left(strStartText, iSpace - 1) > On Error Resume Next > iNumeric = CLng(strLookForNumeric) > If iNumeric > TheMax Then > TheMax = iNumeric > End If > End If > Next > objFSO.CopyFile CurrentDb.Name, objFSOFolder.Path & "\Backup No " & > Format(TheMax + 1, "0000") & " " & strThisApp & Mid(CurrentDb.Name, > InStrRev(CurrentDb.Name, ".")) > RunCommand acCmdSave > End Sub > Function LaunchSaveMe() > On Error Resume Next > DoCmd.Close acForm, "FrmSaveMe", acSaveNo > DoCmd.OpenForm "frmsaveme", acNormal, , , , acHidden > End Function From bensonforums at gmail.com Tue Jun 16 13:32:19 2015 From: bensonforums at gmail.com (Bill Benson) Date: Tue, 16 Jun 2015 14:32:19 -0400 Subject: [AccessD] How to tell if a database has experienced any changes Message-ID: I recently wrote a database subprocedure which makes a backup of the database (from disk) every so often, and then saves the database. As I watch files plopping into my backups folder every so often, I can tell that this routine could easily max out the hard disk if left running unattended (or attended, but by an inattentive user). Some safeguard is needed to insure that does not happen. However I cannot think of a way to test whether the database is in a saved or unsaved condition. I know that Ctrl-S saves the database, does reset any kind of "Dirty" properties of any design-time or code objects such that I can re-test them to see whether anything has changed? I am concerned much more with object changes as a developer, not so much data. I am trying to avoid a bunch of useless saves, so that I could be more particular about what to delete from the backups folder, and not base the decision just on file date or other ordinal position on disk. Any equivalent to ThisWorkbook.Saved to test whether there have been any bona fide changes in the database application (be that data or code). Changes in the database would include changes to objects of any kind, including code changes changes to data without changing objects or dao structures. Thanks for any leads. From bensonforums at gmail.com Tue Jun 16 13:35:03 2015 From: bensonforums at gmail.com (Bill Benson) Date: Tue, 16 Jun 2015 14:35:03 -0400 Subject: [AccessD] Command to save the database In-Reply-To: <55806A17.9020904@torchlake.com> References: <55806A17.9020904@torchlake.com> Message-ID: Hi Tina, I cannot alter that because group policy has set all our macro security settings to Disable with notification. On Tue, Jun 16, 2015 at 2:25 PM, Tina Norris Fields < tinanfields at torchlake.com> wrote: > Hi Bill, > > Sorry if I've just misunderstood, but, wouldn't you want to set the macro > settings to enable, so that the option to enable content never comes up at > all? > > TNF > > Tina Norris Fields > tinanfields-at-torchlake-dot-com > 231-322-2787 > > > On 06/16/15 10:37 AM, Bill Benson wrote: > >> ok, I still need some help - please. >> >> I have been thwarted (temporarily I hope) by two conditions. >> >> I put this code in a form that I want to open on startup. I am getting an >> overflow error, I presume because the value in miliseconds is too high a >> number. However, how else can I make the event occur only at 10 minute >> intervals? >> >> Secondly, when the database opens up, the AutoExec which calls my function >> to open the frmSaveMe form invisibly runs PRIOR to the UI giving the >> option >> to Enable content, and throws up a dialog in which the only response >> appears to be "Stop All Macros". Kinda defeats the purpose of an AutoExec. >> >> There is only one step in the macro, it is RunCode LaunchSaveMe(). >> >> How can I make this macro warning go away, and simply run - preferably >> after Content has been enabled? >> >> Private Sub Form_Load() >> SaveMe >> Me.TimerInterval = 1000 * 60 * 10 >> End Sub >> >> >> Private Sub Form_Timer() >> SaveMe >> End Sub >> >> 'Standard module: >> >> Sub SaveMe() >> Dim objFSO As Object >> Dim objFSOFolder As Object >> Dim strThisApp As String >> Dim iSpace As Long >> Dim iNumeric As Long >> Dim TheMax As Long >> Dim strLookForNumeric As String >> Dim FIL As Object >> Dim strStartText As String >> Dim strPath As String >> strThisApp = Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, "\") + 1) >> strThisApp = Left(strThisApp, InStrRev(strThisApp, ".") - 1) >> Set objFSO = New FileSystemObject >> strPath = Environ("USERPROFILE") & "\My Documents" >> On Error Resume Next >> Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & >> strThisApp) >> If objFSOFolder Is Nothing Then >> Set objFSOFolder = objFSO.GetFolder(strPath & "\Backups for " & >> strThisApp) >> If objFSOFolder Is Nothing Then >> Set objFSOFolder = objFSO.CreateFolder(strPath & "\Backups for " >> & >> strThisApp) >> End If >> End If >> For Each FIL In objFSOFolder.Files >> If InStr(FIL.Name, "Backup No ") > 0 And InStr(FIL.Name, strThisApp) >> > >> 0 Then >> strStartText = Mid(FIL.Name, Len("Backup No ") + 1) >> iSpace = InStr(strStartText, Chr(32)) >> strLookForNumeric = Left(strStartText, iSpace - 1) >> On Error Resume Next >> iNumeric = CLng(strLookForNumeric) >> If iNumeric > TheMax Then >> TheMax = iNumeric >> End If >> End If >> Next >> objFSO.CopyFile CurrentDb.Name, objFSOFolder.Path & "\Backup No " & >> Format(TheMax + 1, "0000") & " " & strThisApp & Mid(CurrentDb.Name, >> InStrRev(CurrentDb.Name, ".")) >> RunCommand acCmdSave >> End Sub >> Function LaunchSaveMe() >> On Error Resume Next >> DoCmd.Close acForm, "FrmSaveMe", acSaveNo >> DoCmd.OpenForm "frmsaveme", acNormal, , , , acHidden >> End Function >> > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From Lambert.Heenan at aig.com Wed Jun 17 11:58:17 2015 From: Lambert.Heenan at aig.com (Heenan, Lambert) Date: Wed, 17 Jun 2015 16:58:17 +0000 Subject: [AccessD] Error creating ACCDE file Message-ID: Cross Posted Access 2010. I'm suddenly getting the error "You cannot add or change a record because a related record is required in table 'MSysAccessStorage'." When I try to create an ACCEE file. I have an ACCDB file which compiles to an ACCDE, but then when I import some modified forms from a development copy, replacing the originals, I then get the above error. I have tried exporting the forms from the development version into the production file , no good. Importing the forms from the production version into the development version. No good. Used SaveAsText method and LoadFromText for the forms. No Good. I wound up having the redo all of the form edits manually in a 'clean' (compiles to ACCDE) file and then recompiling. That worked. Does anyone have any idea what the cause of this misery might be? Lambert From jimdettman at verizon.net Wed Jun 17 13:06:49 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Wed, 17 Jun 2015 14:06:49 -0400 Subject: [AccessD] Error creating ACCDE file In-Reply-To: References: Message-ID: Did you possibly have a custom ribbon? That's the only thing I can think of outside of the form itself that would be stored as a related record. Outside of that, A2010 had a number of bugs out of the gate, so the typical advice applies; make sure your patched to the latest rev. Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Wednesday, June 17, 2015 12:58 PM To: 'Access-D Email (accessd at databaseadvisors.com)'; 'ACCESS-L Email (ACCESS-L at PEACH.EASE.LSOFT.COM)' Subject: [AccessD] Error creating ACCDE file Cross Posted Access 2010. I'm suddenly getting the error "You cannot add or change a record because a related record is required in table 'MSysAccessStorage'." When I try to create an ACCEE file. I have an ACCDB file which compiles to an ACCDE, but then when I import some modified forms from a development copy, replacing the originals, I then get the above error. I have tried exporting the forms from the development version into the production file , no good. Importing the forms from the production version into the development version. No good. Used SaveAsText method and LoadFromText for the forms. No Good. I wound up having the redo all of the form edits manually in a 'clean' (compiles to ACCDE) file and then recompiling. That worked. Does anyone have any idea what the cause of this misery might be? Lambert -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From Lambert.Heenan at aig.com Wed Jun 17 13:12:33 2015 From: Lambert.Heenan at aig.com (Heenan, Lambert) Date: Wed, 17 Jun 2015 18:12:33 +0000 Subject: [AccessD] Error creating ACCDE file In-Reply-To: References: Message-ID: Nope. No custom ribbon. I found that the development ACCDB I was copying objects from would not compile to an ACCDE, but the changes I had made were minor, so I repeated the edits in the destination copy (which were not too extensive) and I was able to create the ACCDE file. If you Google the topic you'll find it cropping up several years ago, long before Access 2007/2010 was released. Lambert -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman Sent: Wednesday, June 17, 2015 2:07 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Error creating ACCDE file Did you possibly have a custom ribbon? That's the only thing I can think of outside of the form itself that would be stored as a related record. Outside of that, A2010 had a number of bugs out of the gate, so the typical advice applies; make sure your patched to the latest rev. Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Wednesday, June 17, 2015 12:58 PM To: 'Access-D Email (accessd at databaseadvisors.com)'; 'ACCESS-L Email (ACCESS-L at PEACH.EASE.LSOFT.COM)' Subject: [AccessD] Error creating ACCDE file Cross Posted Access 2010. I'm suddenly getting the error "You cannot add or change a record because a related record is required in table 'MSysAccessStorage'." When I try to create an ACCEE file. I have an ACCDB file which compiles to an ACCDE, but then when I import some modified forms from a development copy, replacing the originals, I then get the above error. I have tried exporting the forms from the development version into the production file , no good. Importing the forms from the production version into the development version. No good. Used SaveAsText method and LoadFromText for the forms. No Good. I wound up having the redo all of the form edits manually in a 'clean' (compiles to ACCDE) file and then recompiling. That worked. Does anyone have any idea what the cause of this misery might be? Lambert -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From rockysmolin at bchacc.com Wed Jun 17 18:17:58 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Wed, 17 Jun 2015 16:17:58 -0700 Subject: [AccessD] date conversion Message-ID: Dear List: Access 2003 - VBA Is there a function that will convert a date in a text box formatted ddd d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format? MTIA Rocky Smolin Beach Access Software 858-259-4334 www.bchacc.com www.e-z-mrp.com Skype: rocky.smolin From jackandpat.d at gmail.com Wed Jun 17 18:41:46 2015 From: jackandpat.d at gmail.com (jack drawbridge) Date: Wed, 17 Jun 2015 19:41:46 -0400 Subject: [AccessD] date conversion In-Reply-To: References: Message-ID: Rocky, Since you have the 12-Jun-2015, you don't really need the Fri I tried this Dim x As String x = "Fri 12-JUN-2015" Debug.Print CDate(Right(x, 11)) and it returns the short date (I'm in Canada [d/m/y], so I get 12/06/2015) jack On Wed, Jun 17, 2015 at 7:17 PM, Rocky Smolin wrote: > Dear List: > > Access 2003 - VBA > > Is there a function that will convert a date in a text box formatted ddd > d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com > www.e-z-mrp.com > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From steve at datamanagementsolutions.biz Wed Jun 17 18:57:02 2015 From: steve at datamanagementsolutions.biz (Steve Schapel) Date: Thu, 18 Jun 2015 11:57:02 +1200 Subject: [AccessD] date conversion In-Reply-To: References: Message-ID: Hi Rocky When you say "date in a text box", if it's a date then it's a date, and doesn't need conversion, just change the format. Or do you mean it is a Text data type? Regards Steve -----Original Message----- From: Rocky Smolin Sent: Thursday, June 18, 2015 11:17 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] date conversion Dear List: Access 2003 - VBA Is there a function that will convert a date in a text box formatted ddd d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format? MTIA Rocky Smolin Beach Access Software 858-259-4334 www.bchacc.com www.e-z-mrp.com Skype: rocky.smolin -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From stuart at lexacorp.com.pg Wed Jun 17 19:59:38 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 18 Jun 2015 10:59:38 +1000 Subject: [AccessD] date conversion In-Reply-To: References: Message-ID: <558217FA.9329.2A0710DE@stuart.lexacorp.com.pg> Datevalue doesn't like the ddd part so you need to strip it. This works: Format(datevalue(mid$("Fri 12-JUN-2015",5)),"mm/dd/yyyy") On 17 Jun 2015 at 16:17, Rocky Smolin wrote: > Dear List: > > Access 2003 - VBA > > Is there a function that will convert a date in a text box formatted > ddd d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com > www.e-z-mrp.com > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From stuart at lexacorp.com.pg Wed Jun 17 20:07:07 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 18 Jun 2015 11:07:07 +1000 Subject: [AccessD] date conversion In-Reply-To: References: , Message-ID: <558219BB.26753.2A0DEDF3@stuart.lexacorp.com.pg> Good point. If it is an actual date field in a textbox, explicitly use txtSomeDate.Value rather than txtSomeDate or txtSomeDate.Text On 18 Jun 2015 at 11:57, Steve Schapel wrote: > Hi Rocky > > When you say "date in a text box", if it's a date then it's a date, > and doesn't need conversion, just change the format. Or do you mean > it is a Text data type? > > Regards > Steve > > -----Original Message----- > From: Rocky Smolin > Sent: Thursday, June 18, 2015 11:17 AM > To: 'Access Developers discussion and problem solving' > Subject: [AccessD] date conversion > > Dear List: > > Access 2003 - VBA > > Is there a function that will convert a date in a text box formatted > ddd d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com > www.e-z-mrp.com > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From rockysmolin at bchacc.com Wed Jun 17 20:28:51 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Wed, 17 Jun 2015 18:28:51 -0700 Subject: [AccessD] date conversion In-Reply-To: References: Message-ID: Well it's an unbound text box. R -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel Sent: Wednesday, June 17, 2015 4:57 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] date conversion Hi Rocky When you say "date in a text box", if it's a date then it's a date, and doesn't need conversion, just change the format. Or do you mean it is a Text data type? Regards Steve -----Original Message----- From: Rocky Smolin Sent: Thursday, June 18, 2015 11:17 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] date conversion Dear List: Access 2003 - VBA Is there a function that will convert a date in a text box formatted ddd d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format? MTIA Rocky Smolin Beach Access Software 858-259-4334 www.bchacc.com www.e-z-mrp.com Skype: rocky.smolin -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From rockysmolin at bchacc.com Thu Jun 18 10:44:22 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Thu, 18 Jun 2015 08:44:22 -0700 Subject: [AccessD] date conversion In-Reply-To: References: Message-ID: <5B6FDB3D4A754733B93885D3FA19CA76@HAL9007> Correct! Thanks Jack. R -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jack drawbridge Sent: Wednesday, June 17, 2015 4:42 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] date conversion Rocky, Since you have the 12-Jun-2015, you don't really need the Fri I tried this Dim x As String x = "Fri 12-JUN-2015" Debug.Print CDate(Right(x, 11)) and it returns the short date (I'm in Canada [d/m/y], so I get 12/06/2015) jack On Wed, Jun 17, 2015 at 7:17 PM, Rocky Smolin wrote: > Dear List: > > Access 2003 - VBA > > Is there a function that will convert a date in a text box formatted > ddd d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com www.e-z-mrp.com > > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Thu Jun 25 08:22:33 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 25 Jun 2015 09:22:33 -0400 Subject: [AccessD] Ac2013 startup form Message-ID: I have created a popup form that I want to display as a splash screen. Unfortunately on startup, before any macros are enabled and therefore before my code can shape the form to the required size and put it in the required position, it is opening super-huge. I could control this with an AutoExec that opens the form, but then the user would be getting informaed that macros are present, and all have been halted. That is an annoyance that has utterly put me off the AutoExec macro - so if anyone knows how to make THAT stop I would be grateful as well. So here I am with a form I know how large it should be - and really want it to be because the image I use as its background is getting centered and looks ugly on a stretched out form. the kind of code I would be running to control the size and position is shown below. I don't know why the darned form won't just stay in that condition. Option Compare Database Option Explicit Private Sub cmdBatch_Click() DoCmd.OpenForm "frmBatchReporting" End Sub Private Sub cmdSingle_Click() DoCmd.OpenForm "frmreportingfilters" End Sub Private Sub Form_Load() DoCmd.MoveSize 5000, 2000, 8000, 5000 lblEnableContent.Visible = False cmdSingle.Visible = True cmdBatch.Visible = True End Sub From bensonforums at gmail.com Thu Jun 25 08:31:40 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 25 Jun 2015 09:31:40 -0400 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: Apparently changing border style from sizeable to dialog solved the problem with size. Now if I could just get positioning to work without the intervention of VBA/macros? On Thu, Jun 25, 2015 at 9:22 AM, Bill Benson wrote: > I have created a popup form that I want to display as a splash screen. > Unfortunately on startup, before any macros are enabled and therefore > before my code can shape the form to the required size and put it in the > required position, it is opening super-huge. > > I could control this with an AutoExec that opens the form, but then the > user would be getting informaed that macros are present, and all have been > halted. That is an annoyance that has utterly put me off the AutoExec macro > - so if anyone knows how to make THAT stop I would be grateful as well. > > So here I am with a form I know how large it should be - and really want > it to be because the image I use as its background is getting centered and > looks ugly on a stretched out form. the kind of code I would be running to > control the size and position is shown below. I don't know why the darned > form won't just stay in that condition. > > Option Compare Database > Option Explicit > Private Sub cmdBatch_Click() > DoCmd.OpenForm "frmBatchReporting" > End Sub > Private Sub cmdSingle_Click() > DoCmd.OpenForm "frmreportingfilters" > End Sub > Private Sub Form_Load() > DoCmd.MoveSize 5000, 2000, 8000, 5000 > lblEnableContent.Visible = False > cmdSingle.Visible = True > cmdBatch.Visible = True > End Sub > From bensonforums at gmail.com Thu Jun 25 08:35:30 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 25 Jun 2015 09:35:30 -0400 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: OMG this is utterly unbelievable - making that change did NOT help. It randomly goes back to a huge dialog. Arggghhh On Thu, Jun 25, 2015 at 9:31 AM, Bill Benson wrote: > Apparently changing border style from sizeable to dialog solved the > problem with size. Now if I could just get positioning to work without the > intervention of VBA/macros? > > On Thu, Jun 25, 2015 at 9:22 AM, Bill Benson > wrote: > >> I have created a popup form that I want to display as a splash screen. >> Unfortunately on startup, before any macros are enabled and therefore >> before my code can shape the form to the required size and put it in the >> required position, it is opening super-huge. >> >> I could control this with an AutoExec that opens the form, but then the >> user would be getting informaed that macros are present, and all have been >> halted. That is an annoyance that has utterly put me off the AutoExec macro >> - so if anyone knows how to make THAT stop I would be grateful as well. >> >> So here I am with a form I know how large it should be - and really want >> it to be because the image I use as its background is getting centered and >> looks ugly on a stretched out form. the kind of code I would be running to >> control the size and position is shown below. I don't know why the darned >> form won't just stay in that condition. >> >> Option Compare Database >> Option Explicit >> Private Sub cmdBatch_Click() >> DoCmd.OpenForm "frmBatchReporting" >> End Sub >> Private Sub cmdSingle_Click() >> DoCmd.OpenForm "frmreportingfilters" >> End Sub >> Private Sub Form_Load() >> DoCmd.MoveSize 5000, 2000, 8000, 5000 >> lblEnableContent.Visible = False >> cmdSingle.Visible = True >> cmdBatch.Visible = True >> End Sub >> > > From jimdettman at verizon.net Thu Jun 25 08:38:54 2015 From: jimdettman at verizon.net (Jim Dettman) Date: Thu, 25 Jun 2015 09:38:54 -0400 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: <251212519C6D4FE88FD382C93EFE893F@XPS> You should be able to open it hidden, do a MoveSize operation, then make it visible to get it where you want. Also don't forget about auto size and center. Jim. -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Thursday, June 25, 2015 09:32 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 startup form Apparently changing border style from sizeable to dialog solved the problem with size. Now if I could just get positioning to work without the intervention of VBA/macros? On Thu, Jun 25, 2015 at 9:22 AM, Bill Benson wrote: > I have created a popup form that I want to display as a splash screen. > Unfortunately on startup, before any macros are enabled and therefore > before my code can shape the form to the required size and put it in the > required position, it is opening super-huge. > > I could control this with an AutoExec that opens the form, but then the > user would be getting informaed that macros are present, and all have been > halted. That is an annoyance that has utterly put me off the AutoExec macro > - so if anyone knows how to make THAT stop I would be grateful as well. > > So here I am with a form I know how large it should be - and really want > it to be because the image I use as its background is getting centered and > looks ugly on a stretched out form. the kind of code I would be running to > control the size and position is shown below. I don't know why the darned > form won't just stay in that condition. > > Option Compare Database > Option Explicit > Private Sub cmdBatch_Click() > DoCmd.OpenForm "frmBatchReporting" > End Sub > Private Sub cmdSingle_Click() > DoCmd.OpenForm "frmreportingfilters" > End Sub > Private Sub Form_Load() > DoCmd.MoveSize 5000, 2000, 8000, 5000 > lblEnableContent.Visible = False > cmdSingle.Visible = True > cmdBatch.Visible = True > End Sub > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From df.waters at outlook.com Thu Jun 25 08:36:43 2015 From: df.waters at outlook.com (Dan Waters) Date: Thu, 25 Jun 2015 08:36:43 -0500 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: Hi Bill, With the form in Design mode, find the AutoCenter property under the Format tab and set it to Yes. I think that will do it! Dan -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Thursday, June 25, 2015 8:32 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 startup form Apparently changing border style from sizeable to dialog solved the problem with size. Now if I could just get positioning to work without the intervention of VBA/macros? On Thu, Jun 25, 2015 at 9:22 AM, Bill Benson wrote: > I have created a popup form that I want to display as a splash screen. > Unfortunately on startup, before any macros are enabled and therefore > before my code can shape the form to the required size and put it in > the required position, it is opening super-huge. > > I could control this with an AutoExec that opens the form, but then > the user would be getting informaed that macros are present, and all > have been halted. That is an annoyance that has utterly put me off the > AutoExec macro > - so if anyone knows how to make THAT stop I would be grateful as well. > > So here I am with a form I know how large it should be - and really > want it to be because the image I use as its background is getting > centered and looks ugly on a stretched out form. the kind of code I > would be running to control the size and position is shown below. I > don't know why the darned form won't just stay in that condition. > > Option Compare Database > Option Explicit > Private Sub cmdBatch_Click() > DoCmd.OpenForm "frmBatchReporting" > End Sub > Private Sub cmdSingle_Click() > DoCmd.OpenForm "frmreportingfilters" > End Sub > Private Sub Form_Load() > DoCmd.MoveSize 5000, 2000, 8000, 5000 > lblEnableContent.Visible = False > cmdSingle.Visible = True > cmdBatch.Visible = True > End Sub > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From gustav at cactus.dk Thu Jun 25 08:42:06 2015 From: gustav at cactus.dk (Gustav Brock) Date: Thu, 25 Jun 2015 13:42:06 +0000 Subject: [AccessD] Ac2013 startup form Message-ID: Hi Bill Launch your splash by selecting it as the start form under Options, Current Database. Set the form's AutoCenter and AutoSize to Yes. /gustav -----Oprindelig meddelelse----- Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] P? vegne af Bill Benson Sendt: 25. juni 2015 15:32 Til: Access Developers discussion and problem solving Emne: Re: [AccessD] Ac2013 startup form Apparently changing border style from sizeable to dialog solved the problem with size. Now if I could just get positioning to work without the intervention of VBA/macros? On Thu, Jun 25, 2015 at 9:22 AM, Bill Benson wrote: > I have created a popup form that I want to display as a splash screen. > Unfortunately on startup, before any macros are enabled and therefore > before my code can shape the form to the required size and put it in > the required position, it is opening super-huge. > > I could control this with an AutoExec that opens the form, but then > the user would be getting informaed that macros are present, and all > have been halted. That is an annoyance that has utterly put me off the > AutoExec macro > - so if anyone knows how to make THAT stop I would be grateful as well. > > So here I am with a form I know how large it should be - and really > want it to be because the image I use as its background is getting > centered and looks ugly on a stretched out form. the kind of code I > would be running to control the size and position is shown below. I > don't know why the darned form won't just stay in that condition. > > Option Compare Database > Option Explicit > Private Sub cmdBatch_Click() > DoCmd.OpenForm "frmBatchReporting" > End Sub > Private Sub cmdSingle_Click() > DoCmd.OpenForm "frmreportingfilters" > End Sub > Private Sub Form_Load() > DoCmd.MoveSize 5000, 2000, 8000, 5000 > lblEnableContent.Visible = False > cmdSingle.Visible = True > cmdBatch.Visible = True > End Sub From df.waters at outlook.com Thu Jun 25 08:42:58 2015 From: df.waters at outlook.com (Dan Waters) Date: Thu, 25 Jun 2015 08:42:58 -0500 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: Hi Bill, There are many sites which explain how to set up a splash screen. Do a search on 'create a splash screen in access' - lots of pages! Dan -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Thursday, June 25, 2015 8:36 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 startup form OMG this is utterly unbelievable - making that change did NOT help. It randomly goes back to a huge dialog. Arggghhh On Thu, Jun 25, 2015 at 9:31 AM, Bill Benson wrote: > Apparently changing border style from sizeable to dialog solved the > problem with size. Now if I could just get positioning to work without > the intervention of VBA/macros? > > On Thu, Jun 25, 2015 at 9:22 AM, Bill Benson > wrote: > >> I have created a popup form that I want to display as a splash screen. >> Unfortunately on startup, before any macros are enabled and therefore >> before my code can shape the form to the required size and put it in >> the required position, it is opening super-huge. >> >> I could control this with an AutoExec that opens the form, but then >> the user would be getting informaed that macros are present, and all >> have been halted. That is an annoyance that has utterly put me off >> the AutoExec macro >> - so if anyone knows how to make THAT stop I would be grateful as well. >> >> So here I am with a form I know how large it should be - and really >> want it to be because the image I use as its background is getting >> centered and looks ugly on a stretched out form. the kind of code I >> would be running to control the size and position is shown below. I >> don't know why the darned form won't just stay in that condition. >> >> Option Compare Database >> Option Explicit >> Private Sub cmdBatch_Click() >> DoCmd.OpenForm "frmBatchReporting" >> End Sub >> Private Sub cmdSingle_Click() >> DoCmd.OpenForm "frmreportingfilters" >> End Sub >> Private Sub Form_Load() >> DoCmd.MoveSize 5000, 2000, 8000, 5000 lblEnableContent.Visible = >> False cmdSingle.Visible = True cmdBatch.Visible = True End Sub >> > > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From rockysmolin at bchacc.com Thu Jun 25 09:13:19 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Thu, 25 Jun 2015 07:13:19 -0700 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: Unfortunately (for you :)) a bit of VBA is the solution. I use MoveSize method a lot to position, and size, those pop ups. r -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Thursday, June 25, 2015 6:32 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 startup form Apparently changing border style from sizeable to dialog solved the problem with size. Now if I could just get positioning to work without the intervention of VBA/macros? On Thu, Jun 25, 2015 at 9:22 AM, Bill Benson wrote: > I have created a popup form that I want to display as a splash screen. > Unfortunately on startup, before any macros are enabled and therefore > before my code can shape the form to the required size and put it in > the required position, it is opening super-huge. > > I could control this with an AutoExec that opens the form, but then > the user would be getting informaed that macros are present, and all > have been halted. That is an annoyance that has utterly put me off the > AutoExec macro > - so if anyone knows how to make THAT stop I would be grateful as well. > > So here I am with a form I know how large it should be - and really > want it to be because the image I use as its background is getting > centered and looks ugly on a stretched out form. the kind of code I > would be running to control the size and position is shown below. I > don't know why the darned form won't just stay in that condition. > > Option Compare Database > Option Explicit > Private Sub cmdBatch_Click() > DoCmd.OpenForm "frmBatchReporting" > End Sub > Private Sub cmdSingle_Click() > DoCmd.OpenForm "frmreportingfilters" > End Sub > Private Sub Form_Load() > DoCmd.MoveSize 5000, 2000, 8000, 5000 > lblEnableContent.Visible = False > cmdSingle.Visible = True > cmdBatch.Visible = True > End Sub > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Thu Jun 25 09:58:44 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 25 Jun 2015 10:58:44 -0400 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: None of these suggestions help. For those which reference VBA, as I stated early on, this is a problem with Macros not being enabled yet. Setting AutoCenter to Yes did not help reduce the dialog to the desired size (its last saved size was nice and compact - just as it appears in Design View). SOMETHING must be stretching this form out to monstrous proportions. Since no VBA can be affecting the form on startup, and its size is compact in design view, I think there must be a bug in MS Access. Rocky - since you know (now at least, I hope) that this problem manifests before macros run - and since you also know I am getting a runtime message about macros (with a requirement to halt them) therefore AutoExec doesn't save me - is there any other recommendation you have? As I said earlier, I thought I had a solution by changing the Border Style from Sizable to Dialog, because the very next time I opened the form it looked fine. However I think I was misled by the possibility that macros could have already been enabled while I did that test. the very next time I opened the database to this startup form, it was back to a huge splash screen ... and my nice background was runined and the controls I wanted to appear nice and centered, on a compact form, were oddly positioned vis a vis the form's large dimensions. Hugely frustrating. On Thu, Jun 25, 2015 at 10:13 AM, Rocky Smolin wrote: > Unfortunately (for you :)) a bit of VBA is the solution. I use MoveSize > method a lot to position, and size, those pop ups. > > r > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Thursday, June 25, 2015 6:32 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 startup form > > Apparently changing border style from sizeable to dialog solved the problem > with size. Now if I could just get positioning to work without the > intervention of VBA/macros? > > On Thu, Jun 25, 2015 at 9:22 AM, Bill Benson > wrote: > > > I have created a popup form that I want to display as a splash screen. > > Unfortunately on startup, before any macros are enabled and therefore > > before my code can shape the form to the required size and put it in > > the required position, it is opening super-huge. > > > > I could control this with an AutoExec that opens the form, but then > > the user would be getting informaed that macros are present, and all > > have been halted. That is an annoyance that has utterly put me off the > > AutoExec macro > > - so if anyone knows how to make THAT stop I would be grateful as well. > > > > So here I am with a form I know how large it should be - and really > > want it to be because the image I use as its background is getting > > centered and looks ugly on a stretched out form. the kind of code I > > would be running to control the size and position is shown below. I > > don't know why the darned form won't just stay in that condition. > > > > Option Compare Database > > Option Explicit > > Private Sub cmdBatch_Click() > > DoCmd.OpenForm "frmBatchReporting" > > End Sub > > Private Sub cmdSingle_Click() > > DoCmd.OpenForm "frmreportingfilters" > > End Sub > > Private Sub Form_Load() > > DoCmd.MoveSize 5000, 2000, 8000, 5000 > > lblEnableContent.Visible = False > > cmdSingle.Visible = True > > cmdBatch.Visible = True > > End Sub > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From rockysmolin at bchacc.com Thu Jun 25 10:01:45 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Thu, 25 Jun 2015 08:01:45 -0700 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: Well, there's always the nuclear option of getting rid of the macros being triggered by that form. I never used macros myself being warned off them in favor of VBA when I started with Access 97. So I'm no help when it comes to macro advice. R -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Thursday, June 25, 2015 7:59 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Ac2013 startup form None of these suggestions help. For those which reference VBA, as I stated early on, this is a problem with Macros not being enabled yet. Setting AutoCenter to Yes did not help reduce the dialog to the desired size (its last saved size was nice and compact - just as it appears in Design View). SOMETHING must be stretching this form out to monstrous proportions. Since no VBA can be affecting the form on startup, and its size is compact in design view, I think there must be a bug in MS Access. Rocky - since you know (now at least, I hope) that this problem manifests before macros run - and since you also know I am getting a runtime message about macros (with a requirement to halt them) therefore AutoExec doesn't save me - is there any other recommendation you have? As I said earlier, I thought I had a solution by changing the Border Style from Sizable to Dialog, because the very next time I opened the form it looked fine. However I think I was misled by the possibility that macros could have already been enabled while I did that test. the very next time I opened the database to this startup form, it was back to a huge splash screen ... and my nice background was runined and the controls I wanted to appear nice and centered, on a compact form, were oddly positioned vis a vis the form's large dimensions. Hugely frustrating. On Thu, Jun 25, 2015 at 10:13 AM, Rocky Smolin wrote: > Unfortunately (for you :)) a bit of VBA is the solution. I use > MoveSize method a lot to position, and size, those pop ups. > > r > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf > Of Bill Benson > Sent: Thursday, June 25, 2015 6:32 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Ac2013 startup form > > Apparently changing border style from sizeable to dialog solved the > problem with size. Now if I could just get positioning to work without > the intervention of VBA/macros? > > On Thu, Jun 25, 2015 at 9:22 AM, Bill Benson > wrote: > > > I have created a popup form that I want to display as a splash screen. > > Unfortunately on startup, before any macros are enabled and > > therefore before my code can shape the form to the required size and > > put it in the required position, it is opening super-huge. > > > > I could control this with an AutoExec that opens the form, but then > > the user would be getting informaed that macros are present, and all > > have been halted. That is an annoyance that has utterly put me off > > the AutoExec macro > > - so if anyone knows how to make THAT stop I would be grateful as well. > > > > So here I am with a form I know how large it should be - and really > > want it to be because the image I use as its background is getting > > centered and looks ugly on a stretched out form. the kind of code I > > would be running to control the size and position is shown below. I > > don't know why the darned form won't just stay in that condition. > > > > Option Compare Database > > Option Explicit > > Private Sub cmdBatch_Click() > > DoCmd.OpenForm "frmBatchReporting" > > End Sub > > Private Sub cmdSingle_Click() > > DoCmd.OpenForm "frmreportingfilters" > > End Sub > > Private Sub Form_Load() > > DoCmd.MoveSize 5000, 2000, 8000, 5000 lblEnableContent.Visible = > > False cmdSingle.Visible = True cmdBatch.Visible = True End Sub > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Thu Jun 25 10:25:48 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 25 Jun 2015 11:25:48 -0400 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: I am making the "Customer" live with it as payback for insisting I design in Ac2013. > > From davidmcafee at gmail.com Thu Jun 25 10:59:43 2015 From: davidmcafee at gmail.com (David McAfee) Date: Thu, 25 Jun 2015 08:59:43 -0700 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: Is it truly a "splash screen" with just a logo or is it a form with controls on it? If just a screen (with a picture/logo) you can put a bitmap (forget if .png and/or .jpg types work) with the same name of the database in the same folder. Access will replace its Access logo with the pic that you provide. If it is a "start up" form, did they take away the option of the startup form ? D On Thu, Jun 25, 2015 at 8:25 AM, Bill Benson wrote: > I am making the "Customer" live with it as payback for insisting I design > in Ac2013. > > > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From gustav at cactus.dk Thu Jun 25 11:23:03 2015 From: gustav at cactus.dk (Gustav Brock) Date: Thu, 25 Jun 2015 16:23:03 +0000 Subject: [AccessD] Ac2013 startup form Message-ID: Hi David That works - with a bmp file. I've completely forgotten that old tip. Thanks! /gustav -----Oprindelig meddelelse----- Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] P? vegne af David McAfee Sendt: 25. juni 2015 18:00 Til: Access Developers discussion and problem solving Emne: Re: [AccessD] Ac2013 startup form Is it truly a "splash screen" with just a logo or is it a form with controls on it? If just a screen (with a picture/logo) you can put a bitmap (forget if .png and/or .jpg types work) with the same name of the database in the same folder. Access will replace its Access logo with the pic that you provide. If it is a "start up" form, did they take away the option of the startup form ? D From stuart at lexacorp.com.pg Thu Jun 25 15:44:28 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Fri, 26 Jun 2015 06:44:28 +1000 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: Message-ID: <558C682C.26700.3550915@stuart.lexacorp.com.pg> By "before any macros are enabled", do you mean that the application is not trusted/in a trusted location and the users has to click to enable macros every time that it is opened? If so, why not just establish trust? -- Stuart On 25 Jun 2015 at 9:22, Bill Benson wrote: > I have created a popup form that I want to display as a splash screen. > Unfortunately on startup, before any macros are enabled and therefore > before my code can shape the form to the required size and put it in > the required position, it is opening super-huge. > > I could control this with an AutoExec that opens the form, but then > the user would be getting informaed that macros are present, and all > have been halted. That is an annoyance that has utterly put me off the > AutoExec macro - so if anyone knows how to make THAT stop I would be > grateful as well. > > So here I am with a form I know how large it should be - and really > want it to be because the image I use as its background is getting > centered and looks ugly on a stretched out form. the kind of code I > would be running to control the size and position is shown below. I > don't know why the darned form won't just stay in that condition. > > Option Compare Database > Option Explicit > Private Sub cmdBatch_Click() > DoCmd.OpenForm "frmBatchReporting" > End Sub > Private Sub cmdSingle_Click() > DoCmd.OpenForm "frmreportingfilters" > End Sub > Private Sub Form_Load() > DoCmd.MoveSize 5000, 2000, 8000, 5000 > lblEnableContent.Visible = False > cmdSingle.Visible = True > cmdBatch.Visible = True > End Sub > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Thu Jun 25 17:31:41 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 25 Jun 2015 18:31:41 -0400 Subject: [AccessD] Ac2013 startup form In-Reply-To: <558C682C.26700.3550915@stuart.lexacorp.com.pg> References: <558C682C.26700.3550915@stuart.lexacorp.com.pg> Message-ID: Stuart - exactly right. Solved the problem. Thank you. On Thu, Jun 25, 2015 at 4:44 PM, Stuart McLachlan wrote: > By "before any macros are enabled", do you mean that the application is > not trusted/in a > trusted location and the users has to click to enable macros every time > that it is opened? > > If so, why not just establish trust? > > -- > Stuart > > > On 25 Jun 2015 at 9:22, Bill Benson wrote: > > > I have created a popup form that I want to display as a splash screen. > > Unfortunately on startup, before any macros are enabled and therefore > > before my code can shape the form to the required size and put it in > > the required position, it is opening super-huge. > > > > I could control this with an AutoExec that opens the form, but then > > the user would be getting informaed that macros are present, and all > > have been halted. That is an annoyance that has utterly put me off the > > AutoExec macro - so if anyone knows how to make THAT stop I would be > > grateful as well. > > > > So here I am with a form I know how large it should be - and really > > want it to be because the image I use as its background is getting > > centered and looks ugly on a stretched out form. the kind of code I > > would be running to control the size and position is shown below. I > > don't know why the darned form won't just stay in that condition. > > > > Option Compare Database > > Option Explicit > > Private Sub cmdBatch_Click() > > DoCmd.OpenForm "frmBatchReporting" > > End Sub > > Private Sub cmdSingle_Click() > > DoCmd.OpenForm "frmreportingfilters" > > End Sub > > Private Sub Form_Load() > > DoCmd.MoveSize 5000, 2000, 8000, 5000 > > lblEnableContent.Visible = False > > cmdSingle.Visible = True > > cmdBatch.Visible = True > > End Sub > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From bensonforums at gmail.com Thu Jun 25 17:33:11 2015 From: bensonforums at gmail.com (Bill Benson) Date: Thu, 25 Jun 2015 18:33:11 -0400 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: <558C682C.26700.3550915@stuart.lexacorp.com.pg> Message-ID: And for those of you who think I must be too dumb to live - just know that it has always been my assumption that trusted locations were on an Office basis - I did not know that all the trusted locations I have added while in MS Excel (which this app's folder was among) - has to be trusted again in MS Access. -Hand smacking forehead! On Thu, Jun 25, 2015 at 6:31 PM, Bill Benson wrote: > Stuart - exactly right. Solved the problem. > Thank you. > > On Thu, Jun 25, 2015 at 4:44 PM, Stuart McLachlan > wrote: > >> By "before any macros are enabled", do you mean that the application is >> not trusted/in a >> trusted location and the users has to click to enable macros every time >> that it is opened? >> >> If so, why not just establish trust? >> >> -- >> Stuart >> >> >> On 25 Jun 2015 at 9:22, Bill Benson wrote: >> >> > I have created a popup form that I want to display as a splash screen. >> > Unfortunately on startup, before any macros are enabled and therefore >> > before my code can shape the form to the required size and put it in >> > the required position, it is opening super-huge. >> > >> > I could control this with an AutoExec that opens the form, but then >> > the user would be getting informaed that macros are present, and all >> > have been halted. That is an annoyance that has utterly put me off the >> > AutoExec macro - so if anyone knows how to make THAT stop I would be >> > grateful as well. >> > >> > So here I am with a form I know how large it should be - and really >> > want it to be because the image I use as its background is getting >> > centered and looks ugly on a stretched out form. the kind of code I >> > would be running to control the size and position is shown below. I >> > don't know why the darned form won't just stay in that condition. >> > >> > Option Compare Database >> > Option Explicit >> > Private Sub cmdBatch_Click() >> > DoCmd.OpenForm "frmBatchReporting" >> > End Sub >> > Private Sub cmdSingle_Click() >> > DoCmd.OpenForm "frmreportingfilters" >> > End Sub >> > Private Sub Form_Load() >> > DoCmd.MoveSize 5000, 2000, 8000, 5000 >> > lblEnableContent.Visible = False >> > cmdSingle.Visible = True >> > cmdBatch.Visible = True >> > End Sub >> > -- >> > AccessD mailing list >> > AccessD at databaseadvisors.com >> > http://databaseadvisors.com/mailman/listinfo/accessd >> > Website: http://www.databaseadvisors.com >> > >> >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> > > From tinanfields at torchlake.com Fri Jun 26 08:51:11 2015 From: tinanfields at torchlake.com (Tina Norris Fields) Date: Fri, 26 Jun 2015 09:51:11 -0400 Subject: [AccessD] Ac2013 startup form In-Reply-To: References: <558C682C.26700.3550915@stuart.lexacorp.com.pg> Message-ID: <558D58CF.8060903@torchlake.com> Bill, Don't beat yourself up too much. We've all missed bits and pieces here and there that seemed obvious to us once we discovered them. Glad you have it solved now, and thanks to Stuart for lifting it up. TNF Tina Norris Fields tinanfields-at-torchlake-dot-com 231-322-2787 On 06/25/15 6:33 PM, Bill Benson wrote: > And for those of you who think I must be too dumb to live - just know that > it has always been my assumption that trusted locations were on an Office > basis - I did not know that all the trusted locations I have added while in > MS Excel (which this app's folder was among) - has to be trusted again in > MS Access. > -Hand smacking forehead! > > On Thu, Jun 25, 2015 at 6:31 PM, Bill Benson wrote: > >> Stuart - exactly right. Solved the problem. >> Thank you. >> >> On Thu, Jun 25, 2015 at 4:44 PM, Stuart McLachlan >> wrote: >> >>> By "before any macros are enabled", do you mean that the application is >>> not trusted/in a >>> trusted location and the users has to click to enable macros every time >>> that it is opened? >>> >>> If so, why not just establish trust? >>> >>> -- >>> Stuart >>> >>> >>> From bensonforums at gmail.com Fri Jun 26 09:07:40 2015 From: bensonforums at gmail.com (Bill Benson) Date: Fri, 26 Jun 2015 10:07:40 -0400 Subject: [AccessD] Hiding or otherwise grouping database objects Message-ID: I have found one thing I like about the Ac2013 interface, and maybe this existed before Ac2013 but I've started using it now - that is adding objects to custom groups for navigating. One problem I have is that I have only found a method to add them to groups manually through the UI. Some of the tabledefs I use get recreated on the fly through make table queries. When that happens, the new object is always in the unassigned category. I think a workaround would be a delete records and append records combination rather than maketable - however I believe some of the queries are edited dynamically or are based on crosstabs such that the resulting fields are not always consistent - hence the choice for maketables. Still, that could probably be controlles through DDL and code. In any case, my shortest path right now would be this - can someone share some VBA method for changing whatever property on an object adds it to a group? Since the same object can be added to more than one group, perhaps I should not call this a property of the object, perhaps it is forcing some addition or removal of the object's name from a collection (or more than one collection). I found some code which I think is part of the solution. But I wouldn't know how to retrieve the required parameters. INSERT INTO MSysNavPaneGroupToObjects ( GroupID, ObjectID, Name ) VALUES ( 55, 418, 'TableName' ) Any pointers? From rockysmolin at bchacc.com Sat Jun 27 11:29:53 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Sat, 27 Jun 2015 09:29:53 -0700 Subject: [AccessD] Date Format Not Working Message-ID: <9DCCFF58E71641B687CCAE13C9DDF8DF@HAL9007> Dear List: I'm having a problem with a date conversion. I have two unbound text boxes holding a date range - txtFromDate and txtToDate. They are formatted Long Date in the property sheet. When I need to filter the form to show only records in that date range, I need to convert it to a short date bracketed by # and embed in a SQL statement as part of the form filter. But whether I use Format(Me.txtFromDate,"Short Date") or format(Me.txtFromDate,"mm/dd/yy") the result is still the Long Date format which the Me.Filter chokes on. Mysterious - I cannot figure out why Format(Me.txtFromDate,"Short Date") doesn't convert the date in the text box to mm/dd/yy format. MsgBox Format(Me.txtFromDate, "Short Date") still shows Tuesday June 14, 2015 and it ends up that way in the Filter which don't work. txtToDate behavior is the same. Any clues? What am I missing/doing wrong? MTIA Rocky Smolin Beach Access Software 858-259-4334 www.bchacc.com www.e-z-mrp.com Skype: rocky.smolin From bensonforums at gmail.com Sat Jun 27 11:48:03 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sat, 27 Jun 2015 12:48:03 -0400 Subject: [AccessD] Date Format Not Working In-Reply-To: <9DCCFF58E71641B687CCAE13C9DDF8DF@HAL9007> References: <9DCCFF58E71641B687CCAE13C9DDF8DF@HAL9007> Message-ID: Try format(cDate(Me.txtFromDate),"mm/dd/yy"). What I think is happening is that format is not recognizing the argument as a genuine date, but rather as text On Sat, Jun 27, 2015 at 12:29 PM, Rocky Smolin wrote: > Dear List: > > I'm having a problem with a date conversion. > > I have two unbound text boxes holding a date range - txtFromDate and > txtToDate. They are formatted Long Date in the property sheet. > > When I need to filter the form to show only records in that date range, I > need to convert it to a short date bracketed by # and embed in a SQL > statement as part of the form filter. > > But whether I use Format(Me.txtFromDate,"Short Date") or > format(Me.txtFromDate,"mm/dd/yy") the result is still the Long Date format > which the Me.Filter chokes on. > > Mysterious - I cannot figure out why Format(Me.txtFromDate,"Short Date") > doesn't convert the date in the text box to mm/dd/yy format. > > MsgBox Format(Me.txtFromDate, "Short Date") still shows Tuesday June 14, > 2015 and it ends up that way in the Filter which don't work. > > txtToDate behavior is the same. > > > Any clues? What am I missing/doing wrong? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com > www.e-z-mrp.com > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From rockysmolin at bchacc.com Sat Jun 27 12:08:49 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Sat, 27 Jun 2015 10:08:49 -0700 Subject: [AccessD] Date Format Not Working In-Reply-To: References: <9DCCFF58E71641B687CCAE13C9DDF8DF@HAL9007> Message-ID: <4BB3E1B218B941D7AB1F1EE6F2ADC631@HAL9007> Bill: That generates a Type Mismatch error. I think the Cdate doesn't like 'Friday, June 28, 2013 ' as an argument. Rocky -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Saturday, June 27, 2015 9:48 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Date Format Not Working Try format(cDate(Me.txtFromDate),"mm/dd/yy"). What I think is happening is that format is not recognizing the argument as a genuine date, but rather as text On Sat, Jun 27, 2015 at 12:29 PM, Rocky Smolin wrote: > Dear List: > > I'm having a problem with a date conversion. > > I have two unbound text boxes holding a date range - txtFromDate and > txtToDate. They are formatted Long Date in the property sheet. > > When I need to filter the form to show only records in that date > range, I need to convert it to a short date bracketed by # and embed > in a SQL statement as part of the form filter. > > But whether I use Format(Me.txtFromDate,"Short Date") or > format(Me.txtFromDate,"mm/dd/yy") the result is still the Long Date > format which the Me.Filter chokes on. > > Mysterious - I cannot figure out why Format(Me.txtFromDate,"Short > Date") doesn't convert the date in the text box to mm/dd/yy format. > > MsgBox Format(Me.txtFromDate, "Short Date") still shows Tuesday June > 14, > 2015 and it ends up that way in the Filter which don't work. > > txtToDate behavior is the same. > > > Any clues? What am I missing/doing wrong? > > MTIA > > Rocky Smolin > Beach Access Software > 858-259-4334 > www.bchacc.com www.e-z-mrp.com > > Skype: rocky.smolin > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com From bensonforums at gmail.com Sat Jun 27 12:10:37 2015 From: bensonforums at gmail.com (Bill Benson) Date: Sat, 27 Jun 2015 13:10:37 -0400 Subject: [AccessD] Date Format Not Working In-Reply-To: <4BB3E1B218B941D7AB1F1EE6F2ADC631@HAL9007> References: <9DCCFF58E71641B687CCAE13C9DDF8DF@HAL9007> <4BB3E1B218B941D7AB1F1EE6F2ADC631@HAL9007> Message-ID: Oh the the answer is simple, parse out the weekday part On Jun 27, 2015 1:09 PM, "Rocky Smolin" wrote: > Bill: > > That generates a Type Mismatch error. I think the Cdate doesn't like > 'Friday, June 28, 2013 ' as an argument. > > Rocky > > > -----Original Message----- > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Bill Benson > Sent: Saturday, June 27, 2015 9:48 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Date Format Not Working > > Try format(cDate(Me.txtFromDate),"mm/dd/yy"). What I think is happening is > that format is not recognizing the argument as a genuine date, but rather > as > text > > On Sat, Jun 27, 2015 at 12:29 PM, Rocky Smolin > wrote: > > > Dear List: > > > > I'm having a problem with a date conversion. > > > > I have two unbound text boxes holding a date range - txtFromDate and > > txtToDate. They are formatted Long Date in the property sheet. > > > > When I need to filter the form to show only records in that date > > range, I need to convert it to a short date bracketed by # and embed > > in a SQL statement as part of the form filter. > > > > But whether I use Format(Me.txtFromDate,"Short Date") or > > format(Me.txtFromDate,"mm/dd/yy") the result is still the Long Date > > format which the Me.Filter chokes on. > > > > Mysterious - I cannot figure out why Format(Me.txtFromDate,"Short > > Date") doesn't convert the date in the text box to mm/dd/yy format. > > > > MsgBox Format(Me.txtFromDate, "Short Date") still shows Tuesday June > > 14, > > 2015 and it ends up that way in the Filter which don't work. > > > > txtToDate behavior is the same. > > > > > > Any clues? What am I missing/doing wrong? > > > > MTIA > > > > Rocky Smolin > > Beach Access Software > > 858-259-4334 > > www.bchacc.com www.e-z-mrp.com > > > > Skype: rocky.smolin > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > From stuart at lexacorp.com.pg Sat Jun 27 17:55:26 2015 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sun, 28 Jun 2015 08:55:26 +1000 Subject: [AccessD] Date Format Not Working In-Reply-To: References: <9DCCFF58E71641B687CCAE13C9DDF8DF@HAL9007>, <4BB3E1B218B941D7AB1F1EE6F2ADC631@HAL9007>, Message-ID: <558F29DE.30867.E19A76F@stuart.lexacorp.com.pg> Alhzeimers? Asked and answered 10 days ago On 17 Jun 2015 at 16:17, Rocky Smolin wrote: > Dear List: > > Access 2003 - VBA > > Is there a function that will convert a date in a text box formatted ddd > d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format? > > MTIA > > Rocky Smolin and the solutions: Datevalue doesn't like the ddd part so you need to strip it. This works: Format(datevalue(mid$("Fri 12-JUN-2015",5)),"mm/dd/yyyy") and If it is an actual date field in a textbox, explicitly use txtSomeDate.Value rather than txtSomeDate or txtSomeDate.Text From rockysmolin at bchacc.com Sat Jun 27 22:46:05 2015 From: rockysmolin at bchacc.com (Rocky Smolin) Date: Sat, 27 Jun 2015 20:46:05 -0700 Subject: [AccessD] Date Format Not Working In-Reply-To: <558F29DE.30867.E19A76F@stuart.lexacorp.com.pg> References: <9DCCFF58E71641B687CCAE13C9DDF8DF@HAL9007>, <4BB3E1B218B941D7AB1F1EE6F2ADC631@HAL9007>, <558F29DE.30867.E19A76F@stuart.lexacorp.com.pg> Message-ID: <5A34EB8DA2BA4ABBBFB1728291ED6F88@HAL9007> But the solutions didn't work. So I'm using Long Date format instead of the client's custom format. So with Bill's help 2 functions - one that returns string and one that returns date. Private Function GetDate(argDate As String) As String GetDate = CDate(Right(argDate, Len(argDate) - InStr(1, argDate, ", "))) End Function Private Function GetDate2(argDate As String) As Date GetDate2 = CDate(Right(argDate, Len(argDate) - InStr(1, argDate, ", "))) End Function So wherever I need mm/dd/yyyy I call the function. Thank you Dr Benson. r -----Original Message----- From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Saturday, June 27, 2015 3:55 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Date Format Not Working Alhzeimers? Asked and answered 10 days ago On 17 Jun 2015 at 16:17, Rocky Smolin wrote: > Dear List: > > Access 2003 - VBA > > Is there a function that will convert a date in a text box formatted > ddd d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format? > > MTIA > > Rocky Smolin and the solutions: Datevalue doesn't like the ddd part so you need to strip it. This works: Format(datevalue(mid$("Fri 12-JUN-2015",5)),"mm/dd/yyyy") and If it is an actual date field in a textbox, explicitly use txtSomeDate.Value rather than txtSomeDate or txtSomeDate.Text -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com