Prev: Creating a Form Desktop Shortcut to ACCDE
Next: Add consecutive dates w/ command button & parameter boxes
From: Flopbot on 11 May 2010 15:35 Hi, I have an unbound form [Frm Volunteer Opportunities] with a sub form [SubFrm Vol Opportunities]. The subform has the fields [Event ID] and [Event Date]. My unbound form has a command button on it. Basically, what I'm trying to do is have Access automatically create 31 new records in [SubFrm Vol Opportunities] whenever I click the button. I want each new record to be dated 5/1/2010, 5/2/2010, 5/3/2010, and so on starting and ending with the dates that I provide in pop-up parameter boxes. Unfortunately, I don't know code although I can probably figure out where to cut/paste it. Yes, I will use each new record. This will greatly decrease the amount of time spent entering data since I would typically be doing it every single month. Thank you for your help!
From: KARL DEWEY on 11 May 2010 16:51 Create a table named CountNumber with field CountNUM containing numbers from 0 (zero) through 31. Use this in your append query -- New_Dates: DateAdd("d", [CountNumber].[CountNUM], CVDate([Forms]![YourForm]![Start_Date])) Date_Spread: [CountNumber].[CountNUM] with criteria -- <=DateDiff("d", CVDate([Forms]![YourForm]![Start_Date]), CVDate([Forms]![YourForm]![End_Date])) SELECT DateAdd("d",[CountNumber].[CountNUM],CVDate([Forms]![YourForm]![Start_Date])) AS New_Dates, [CountNumber].[CountNUM] AS Date_Spread FROM CountNumber WHERE ((([CountNumber].[CountNUM])<=DateDiff("d",CVDate([Forms]![YourForm]![Start_Date]),CVDate([Forms]![YourForm]![End_Date])))); -- Build a little, test a little. "Flopbot" wrote: > Hi, > > I have an unbound form [Frm Volunteer Opportunities] with a sub form [SubFrm > Vol Opportunities]. The subform has the fields [Event ID] and [Event Date]. > My unbound form has a command button on it. > > Basically, what I'm trying to do is have Access automatically create 31 new > records in [SubFrm Vol Opportunities] whenever I click the button. I want > each new record to be dated 5/1/2010, 5/2/2010, 5/3/2010, and so on starting > and ending with the dates that I provide in pop-up parameter boxes. > Unfortunately, I don't know code although I can probably figure out where to > cut/paste it. > > Yes, I will use each new record. This will greatly decrease the amount of > time spent entering data since I would typically be doing it every single > month. > > Thank you for your help! >
From: Flopbot on 12 May 2010 18:43
Karl, I'm looking into Append Queries and will let you know what I find out tomorrow. I guess MS must have 12 ways of doing everything. "KARL DEWEY" wrote: > Create a table named CountNumber with field CountNUM containing numbers from > 0 (zero) through 31. > Use this in your append query -- > New_Dates: DateAdd("d", [CountNumber].[CountNUM], > CVDate([Forms]![YourForm]![Start_Date])) > > Date_Spread: [CountNumber].[CountNUM] > with criteria -- > <=DateDiff("d", CVDate([Forms]![YourForm]![Start_Date]), > CVDate([Forms]![YourForm]![End_Date])) > > > SELECT > DateAdd("d",[CountNumber].[CountNUM],CVDate([Forms]![YourForm]![Start_Date])) > AS New_Dates, [CountNumber].[CountNUM] AS Date_Spread > FROM CountNumber > WHERE > ((([CountNumber].[CountNUM])<=DateDiff("d",CVDate([Forms]![YourForm]![Start_Date]),CVDate([Forms]![YourForm]![End_Date])))); > > -- > Build a little, test a little. > > > "Flopbot" wrote: > > > Hi, > > > > I have an unbound form [Frm Volunteer Opportunities] with a sub form [SubFrm > > Vol Opportunities]. The subform has the fields [Event ID] and [Event Date]. > > My unbound form has a command button on it. > > > > Basically, what I'm trying to do is have Access automatically create 31 new > > records in [SubFrm Vol Opportunities] whenever I click the button. I want > > each new record to be dated 5/1/2010, 5/2/2010, 5/3/2010, and so on starting > > and ending with the dates that I provide in pop-up parameter boxes. > > Unfortunately, I don't know code although I can probably figure out where to > > cut/paste it. > > > > Yes, I will use each new record. This will greatly decrease the amount of > > time spent entering data since I would typically be doing it every single > > month. > > > > Thank you for your help! > > |