473,385 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Date Math for Access 97

J
I have 2 Date fields
DuesLastPaid
DateDuesDue

I want to enter the date of payment in last paid, and
have one year from now show in the dues field

In the AfterUpdate property of the last paid I used
the expression builder and have

=[DateDuesDue]=[DuesLastPaid]+DateAdd("yyyy",1,[DuesLastPaid])

I have also tried in the AfterUpdate
=[DateDuesDue]=DateAdd("yyyy",1,[DuesLastPaid])

If I (maybe not?) understand the Help example for the
DateAdd function, it is supposed to add 1 year to
last paid and put the result in dues due

But... Nothing happens, nothing shows in dues due

Is the above expression wrong... or should I put the
expression in another place (On Exit... or...???)

I have also tried a default value in DateDuesDue of
=DateAdd("yyyy",1,[DuesLastPaid])
And that does nothing as well

Trying to get the dues due field to default to the
last paid field, plus 1 year, has me stumped

One last thing that SHOULD make no difference is
that I set the record source for the form to a very
simple query of all data fields and order by the
LastName field so the data shows on the form by
last name (table is indexed on hidden autonumber)

Thanks, John

Nov 13 '05 #1
9 4600
J wrote:
I have 2 Date fields
DuesLastPaid
DateDuesDue

I want to enter the date of payment in last paid, and
have one year from now show in the dues field

In the AfterUpdate property of the last paid I used
the expression builder and have

=[DateDuesDue]=[DuesLastPaid]+DateAdd("yyyy",1,[DuesLastPaid])

I have also tried in the AfterUpdate
=[DateDuesDue]=DateAdd("yyyy",1,[DuesLastPaid])
In the AfterUpdate event change it to
Me.[DateDuesDue]=DateAdd("yyyy",1,[DuesLastPaid])
assuming the name of the field to be updated is DateDuesDue

If I (maybe not?) understand the Help example for the
DateAdd function, it is supposed to add 1 year to
last paid and put the result in dues due

But... Nothing happens, nothing shows in dues due

Is the above expression wrong... or should I put the
expression in another place (On Exit... or...???)

I have also tried a default value in DateDuesDue of
=DateAdd("yyyy",1,[DuesLastPaid])
And that does nothing as well

Trying to get the dues due field to default to the
last paid field, plus 1 year, has me stumped

One last thing that SHOULD make no difference is
that I set the record source for the form to a very
simple query of all data fields and order by the
LastName field so the data shows on the form by
last name (table is indexed on hidden autonumber)

Thanks, John


Nov 13 '05 #2
J
>In the AfterUpdate event change it to
Me.[DateDuesDue]=DateAdd("yyyy",1,[DuesLastPaid])
assuming the name of the field to be updated is DateDuesDue


I did that, and get an error message

The object doesn't contain the Automation object Me.

I checked (reran) my install and already had all the data
access components installed so have no idea why using Me.
would product an error

Could this be a result of running Access97 on WinXpSp2 ???
Nov 13 '05 #3
J wrote:
In the AfterUpdate event change it to
Me.[DateDuesDue]=DateAdd("yyyy",1,[DuesLastPaid])
assuming the name of the field to be updated is DateDuesDue

I did that, and get an error message

The object doesn't contain the Automation object Me.

I checked (reran) my install and already had all the data
access components installed so have no idea why using Me.
would product an error

Could this be a result of running Access97 on WinXpSp2 ???


Why don't you copy the code you have in the event so folks can see what
you are doing. Also, ensure DuesLastPaid is the NAME of the control you
want to calculate on, not the controlsource.
Nov 13 '05 #4
J
>Why don't you copy the code you have in the event so folks can see what
you are doing. Also, ensure DuesLastPaid is the NAME of the control you
want to calculate on, not the controlsource.


Data fields on the form are DateDuesDue and DuesLastPaid, the
text box names and control source are the same, since the data
fields were copied to the form directly from the field list

Code is (in AfterUpdate of DuesLastPaid)
Me.[DateDuesDue]=DateAdd("yyyy",1,[DuesLastPaid])

Error is
The object doesn't contain the Automation object 'Me.'

I checked (reran setup) my install and already have all the
data access components installed so have no idea why using the
Me. function would product an error

Could this be a result of running Access97 on WinXpSp2 ???

Thanks, John

Nov 13 '05 #5
J wrote:
Why don't you copy the code you have in the event so folks can see what
you are doing. Also, ensure DuesLastPaid is the NAME of the control you
want to calculate on, not the controlsource.

Data fields on the form are DateDuesDue and DuesLastPaid, the
text box names and control source are the same, since the data
fields were copied to the form directly from the field list

Code is (in AfterUpdate of DuesLastPaid)
Me.[DateDuesDue]=DateAdd("yyyy",1,[DuesLastPaid])

Error is
The object doesn't contain the Automation object 'Me.'

I checked (reran setup) my install and already have all the
data access components installed so have no idea why using the
Me. function would product an error

Could this be a result of running Access97 on WinXpSp2 ???

Thanks, John


Enter the word
Me.
does a drop down list appear? Select the field name if it does. If it
doesn't, then try to compile the code for loaded modules...you might
have a problem there.

Click to the left of the Me..., on the bar, to step into the code when
it is run.

Run the form. Update the event. When droped into the code, go to the
immediate window and enter
? Me.[DateDuesDue]
? Me.DateDuesDue
? DateAdd("yyyy",1,[DuesLastPaid])
See if something occurs there.
Nov 13 '05 #6
J wrote:
Why don't you copy the code you have in the event so folks can see what
you are doing. Also, ensure DuesLastPaid is the NAME of the control you
want to calculate on, not the controlsource.

Data fields on the form are DateDuesDue and DuesLastPaid, the
text box names and control source are the same, since the data
fields were copied to the form directly from the field list

Code is (in AfterUpdate of DuesLastPaid)
Me.[DateDuesDue]=DateAdd("yyyy",1,[DuesLastPaid])

Error is
The object doesn't contain the Automation object 'Me.'

I checked (reran setup) my install and already have all the
data access components installed so have no idea why using the
Me. function would product an error

Could this be a result of running Access97 on WinXpSp2 ???


Could be a result of misuse of dots versus bangs :-)

Try Me![DateDuesDue]
or
Me.Controls("DateDuesDue")

--
This sig left intentionally blank
Nov 13 '05 #7
J wrote:
In the AfterUpdate event change it to
Me.[DateDuesDue]=DateAdd("yyyy",1,[DuesLastPaid])
assuming the name of the field to be updated is DateDuesDue

I did that, and get an error message

The object doesn't contain the Automation object Me.

I checked (reran) my install and already had all the data
access components installed so have no idea why using Me.
would product an error

Could this be a result of running Access97 on WinXpSp2 ???


Did you create an event handler procedure? Your previous attempt was in
an expression, that is not the same.

To create an event handler:
* set the AfterUpdate property of the control to [Event Procedure] you
can select this value from the list
* click the three dot button that now appears to the right of this
property (if it doesn't, move off the property first)
* you arrive in the code module for the form. Put the Me.whatever
statement there.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #8
Oops, for some reason I didn't see the rest of the thread before I
posted my interrupt. Never mind.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #9
John, it is unclear to me where you are entering your code, whether it is
in the properties of the control, the code builder for the AfterUpdate
event, the code of the particular form, a global module, or some other
module.

Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert Mark Bram | last post by:
Howdy All! I am trying to write a very brief comparison of the Date and Math objects in terms of instance v static objects. What I have below is my best so far. Any criticisms or suggestions are...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
6
by: Jim Davis | last post by:
Before I reinvent the wheel I thought I'd ask: anybody got a code snippet that will convert the common ISO8601 date formats to a JS date? By "common" I mean at the least ones described in this...
2
by: B Briant | last post by:
I need to write an access query that will pull records from a table if the start or end dates input by the user are within the start and end dates in the db. I can't use BETWEEN because either of...
2
by: Riegn Man | last post by:
I have a problem with access and our time clocks. We have time clocks that put out a .log file with the badge swipes for everybody. There is one .log file for each day. I am pulling that data...
5
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
3
by: jerry.ranch | last post by:
I have a need to convert simple dates (i.e. 02/14/2005) to a number, do some math, and convert back to a date. (in a simple query). The math involves adding or substracting days, and days of the...
2
by: msaccess | last post by:
Dear knowledgeable folks, System: Windows XP and Access 2002. In my participants form, I have the following date fields: EnrollmentDate: the actual date that the participant officially began...
1
by: Sam | last post by:
How do I convert Julian Date to Calendar Date in ASP.Net 1.1 based on following guideline found at Internet? To convert Julian date to Gregorian date: double JD = 2299160.5; double Z =...
4
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.