|
|
Is there a way to autopopulate a date based on a yes or no selection?
I am practicing building a databse and building a video rental store..
I want to place a "due date" based on if it is a new-relase or a non new-release.
so if the customer rents a "new release" I want the due date to be =Date()+2 but if is a old movie =Date()+3 or more..
Is there a way to do this??
|
|
in the data entry form, add code to the "new release" field's AfterUpdate event procedure, something along the lines of
Select Case Me!NewReleaseControlName Case "Yes" Me!DueDateControlName = Date + 2 Case "No" Me!DueDateControlName = Date + 3 Case Else Me!DueDateControlName = Null End Select
read up on the Select Case statement, so you'll understand how it works.
hth
"Mchipser" <Mchipser[ at ]discussions.microsoft.com> wrote in message news:0A94386B-758C-46C4-A6C3-686D298D8A0B[ at ]microsoft.com...
[Quoted Text] > Is there a way to autopopulate a date based on a yes or no selection? > > I am practicing building a databse and building a video rental store.. > > I want to place a "due date" based on if it is a new-relase or a non > new-release. > > so if the customer rents a "new release" I want the due date to be
=Date()+2 > but if is a old movie =Date()+3 or more.. > > Is there a way to do this?? >
|
|
On Thu, 13 Nov 2008 19:22:45 -0800, Mchipser <Mchipser[ at ]discussions.microsoft.com> wrote:
=DateAdd("d",Date(), IIf(MyCheckbox=True, 3, 2))
So we check MyCheckbox, and if it is checked we add 3, otherwise 2. Note that DateAdd is better than Date+x, because who's to say this would add days, not seconds or years? IIf is the "immediate if" function - see help file.
-Tom. Microsoft Access MVP
[Quoted Text] >Is there a way to autopopulate a date based on a yes or no selection? > >I am practicing building a databse and building a video rental store.. > >I want to place a "due date" based on if it is a new-relase or a non >new-release. > >so if the customer rents a "new release" I want the due date to be =Date()+2 >but if is a old movie =Date()+3 or more.. > >Is there a way to do this??
|
|
|
[Quoted Text] > Note that DateAdd is better than Date+x, because who's to say this > would add days, not seconds or years?
my understanding of dates is that they are actually stored as Double number values, where the whole number is a count of days and the decimal value is a fraction of a whole day. if that's correct, wouldn't adding a whole number x to the count of days increase that count by the same x whole days? did i miss the boat on this? tia, tina
"Tom van Stiphout" <tom7744.no.spam[ at ]cox.net> wrote in message news:nitph4tboishkodr43e405lss39bbisonv[ at ]4ax.com... > On Thu, 13 Nov 2008 19:22:45 -0800, Mchipser > <Mchipser[ at ]discussions.microsoft.com> wrote: > > =DateAdd("d",Date(), IIf(MyCheckbox=True, 3, 2)) > > So we check MyCheckbox, and if it is checked we add 3, otherwise 2. > Note that DateAdd is better than Date+x, because who's to say this > would add days, not seconds or years? > IIf is the "immediate if" function - see help file. > > -Tom. > Microsoft Access MVP > > > > >Is there a way to autopopulate a date based on a yes or no selection? > > > >I am practicing building a databse and building a video rental store.. > > > >I want to place a "due date" based on if it is a new-relase or a non > >new-release. > > > >so if the customer rents a "new release" I want the due date to be =Date()+2 > >but if is a old movie =Date()+3 or more.. > > > >Is there a way to do this??
|
|
On Fri, 14 Nov 2008 04:20:14 GMT, "tina" <nospam[ at ]address.com> wrote:
It does indeed work like that. Still, I like to be explicit.
-Tom.
[Quoted Text] >> Note that DateAdd is better than Date+x, because who's to say this >> would add days, not seconds or years? > >my understanding of dates is that they are actually stored as Double number >values, where the whole number is a count of days and the decimal value is a >fraction of a whole day. if that's correct, wouldn't adding a whole number x >to the count of days increase that count by the same x whole days? did i >miss the boat on this? tia, tina > > >"Tom van Stiphout" <tom7744.no.spam[ at ]cox.net> wrote in message >news:nitph4tboishkodr43e405lss39bbisonv[ at ]4ax.com... >> On Thu, 13 Nov 2008 19:22:45 -0800, Mchipser >> <Mchipser[ at ]discussions.microsoft.com> wrote: >> >> =DateAdd("d",Date(), IIf(MyCheckbox=True, 3, 2)) >> >> So we check MyCheckbox, and if it is checked we add 3, otherwise 2. >> Note that DateAdd is better than Date+x, because who's to say this >> would add days, not seconds or years? >> IIf is the "immediate if" function - see help file. >> >> -Tom. >> Microsoft Access MVP >> >> >> >> >Is there a way to autopopulate a date based on a yes or no selection? >> > >> >I am practicing building a databse and building a video rental store.. >> > >> >I want to place a "due date" based on if it is a new-relase or a non >> >new-release. >> > >> >so if the customer rents a "new release" I want the due date to be >=Date()+2 >> >but if is a old movie =Date()+3 or more.. >> > >> >Is there a way to do this?? >
|
|
|