date manipulation

G

golan

hello; i have a form that have date txtbox format mm/yy.
i want to check in the table what the last date that some customer paid and
to add one monte . for example if the date in the table 11/08 the date in the
form will be 12/08
 
T

Tom van Stiphout

Date math is done with the DateAdd function. Look it up in the help
file.
Select MyDateColumn, DateAdd("m", 1, MyDateColumn) as NextMonth
from MyTable

-Tom.
Microsoft Access MVP
 
K

Ken Sheridan

i need that the function add it to the last month

If the PaymenDate column is a true date/time data type then use:

=Format(DateAdd("m",1,DMax("PaymentDate", "Payments", "CustomerID = "
& [CustomerID])),"mm/yy")

If the last payment is stored in a text field in the table in a format
mm/yy then use the following as the ControlSource of a text box on
your form:

=Format(DateAdd("m",1,DMax("DateSerial(Right(PaymentDate,2),Left
(PaymentDate,2),1)","Payments","CustomerID = " & [CustomerID])),"mm/
yy")

where Payments is the table name, PaymentDate is the name of the text
column containing the payment dates in mm/yy format, and CustomerID is
a foreign key column of number data type identifying the customer.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top