Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 22nd, 2004, 08:05 AM
Authorized User
 
Join Date: Mar 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just changed the field type to a text one and it gave me this answer:1978. I always have both dates in the table: 2004-06-06 and 2004-06-08....

Patrica Molard
 
Old April 22nd, 2004, 08:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

No, keep the field type as DATE. You never want to express dates as text. Without seeing your database, it's difficult to determine anything further... any other ideas out there?


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old April 22nd, 2004, 10:35 AM
Authorized User
 
Join Date: Mar 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The BD for this test is really simple:
 - 1 table: Placettes with 1 field: DATE_INV (format:Date, 2004-06-06 short format, no mask, no default value,)
 - 1 form: Form1 to fill this table
I already have values in this tables.

I wrote this code at the OPEN EVENT of the form1:

Private Sub Form_Open(Cancel As Integer)
Me.DATE_INV.DefaultValue = Nz(DMax("[DATE_INV]", _
   "Placettes", "[DATE_INV] <= #" & Date & "#"), Date)
End Sub

The result is a new date for each new record but it's 1905-05-31!!!
I really want to use this function and in VB it seems easier than what I already did with macro. BUT it has to work...
Thanks

Patrica Molard
 
Old April 22nd, 2004, 10:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Your code seems fine... here's an off-the-wall question. When was the last time you reset your computer clock?!

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old April 22nd, 2004, 10:58 AM
Authorized User
 
Join Date: Mar 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What do you mean by this ? The windows one, at the right bottom cormer: this one is ok.
Do I have to do something else to reset it ???

Patrica Molard
 
Old April 22nd, 2004, 11:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Try these two tests:

1) If you hold your mouse over the time on the bottom right, today's date appears in a pop-up box. Is that showing the correct date?

2) Go to your dB and open any module. Click VIEW > IMMEDIATE WINDOW. In there, type this:

? Date()

and press ENTER. What does THAT date say?


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old April 22nd, 2004, 12:12 PM
Authorized User
 
Join Date: Mar 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It says the right one: 2004-04-22

Patrica Molard
 
Old April 22nd, 2004, 01:02 PM
Authorized User
 
Join Date: Mar 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe a new idea: I never create new records. I always navigate through all the records of Placettes'table. The user is not even allowed to create a new one.

Patrica Molard





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing unique record from form to form Baconant Beginning VB 6 1 January 2nd, 2008 06:20 PM
How do I delete a record from a form? dstein4d Access VBA 8 August 24th, 2007 12:09 PM
Search for a record using a form a_wahab Access 6 September 1st, 2006 12:03 PM
ListView record in a form osemollie Pro VB Databases 7 May 19th, 2006 04:05 AM
Adding a record using a form cailos Access 2 October 12th, 2003 11:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.