Myreader.co.uk  
uk news, chat and community
   home   |   control panel login   |   archive   |  
 
education
16plus
behavioural
gcse+standard
governors
home-education
maths
misc
openuniversity
schools-it
staffroom
teachers
teachers.trainee
  
 
date: Tue, 29 Jan 2008 21:06:47 GMT,    group: uk.education.schools-it        back       
Using SetValue in Access to add to a date   
I have a student that wants to use SetValue in a macro to increase a value 
in a field. DateIn is the field that holds the date bought and DateDue is 
the date that the product needs servicing. The macro is:

GoToControl  = [DateDue]
SetValue =  Item: [Forms]![frm_test]![txtDateDue]
                    Expression: 
[Forms]![frm_test]![txtDateDue]=DateAdd("m",12,[DateIn])

I've used SetValue to increase a numerical value but not a date.

An Update query will do the job but does anyone have an idea on why the 
Macro will not work.

Steve Walker
date: Tue, 29 Jan 2008 21:06:47 GMT   author:   Steve Walker

Re: Using SetValue in Access to add to a date   
On Tue, 29 Jan 2008 21:06:47 GMT, "Steve Walker"
 wrote:

>I have a student that wants to use SetValue in a macro to increase a value 
>in a field. DateIn is the field that holds the date bought and DateDue is 
>the date that the product needs servicing. The macro is:
>
>GoToControl  = [DateDue]
>SetValue =  Item: [Forms]![frm_test]![txtDateDue]
>                    Expression: 
>[Forms]![frm_test]![txtDateDue]=DateAdd("m",12,[DateIn])
>
>I've used SetValue to increase a numerical value but not a date.
>
>An Update query will do the job but does anyone have an idea on why the 
>Macro will not work.
>
A day(ish) late and a dollar short FatMax arrives...

...syntax

In the setvalue part of the macro:

Item should be:
[txtDateDue]

Expression should just be:
DateAdd("m",12,[DateIn])

You don't need the full control names and there's no = sign in the
expression.

You don't need the GoToControl part either but it doesn't actually
stop the macro working.

HTH

-- 
Pope FatMax 2.3.1
date: Sat, 02 Feb 2008 10:59:03 +0000   author:   FatMax

Google
 
Web myreader.co.uk


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us