Pressing + or - key

Danielf

Registered User.
Local time
Today, 09:31
Joined
Feb 21, 2000
Messages
103
Hi,

I was using Access 2000 and WindowsMe. I have
installed it with WindowsXp and I have encountered the following error :
In a form, I have a date field with date() as default. When I was pressing the minus key or the + key, the date was changing with one day. Now it doesn't work anymore ; when pressing the plus key or the minus key, I have a "+" or a "-" .

This is the code

Private Sub XDATE_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 107 Then

Me![XDATE] = Me![XDATE] + 1

ElseIf KeyCode = 109 Then

Me![XDATE] = Me![XDATE] - 1

End If

The only difference between the version of my database using WindowsMe and WindowsXp
is the "References " ;
With WindowsMe I was using Microsoft Vba extensibility 6 and now I am using Microsoft
Vba extensibility 5.3.

But I don't know if this is the reason why it doesn't work anymore.

Thanks for help.

Daniel
 
See if this works:

replace
Me![XDATE] = Me![XDATE] + 1
with
Me![XDATE] = DateAdd("d", 1, Me![XDate])
Me.Refresh

and

Me![XDATE] = Me![XDATE] -1
with
Me![XDATE] = DateAdd("d", -1, Me![XDate])
Me.Refresh

HTH
 
Hi Fizzio,

Thanks for the answer but in the mean time
I have found the solution. It was a problem of date format and now it works.

Daniel
 

Users who are viewing this thread

Back
Top Bottom