Has anyone else had this problem

SiE

Registered User.
Local time
Today, 12:25
Joined
Mar 1, 2002
Messages
25
I have a form which contains a few fields two of which hold dates and have the short date format selected.

I then have a function which is called along with one of these dates. working_date_func(start_date_1). The function then does some calculations and returns a value, all pretty simple stuff.

The function works on my machine as it should along with several of the other machines in the office but when tried on other pc's the function takes the date as a time and I get a data type mismatch error. Its really annoying because all formats and types are set out as date and not time and the date brought in from the function comes in as 00:00:00.

Any ideas or has anyone had this error before?

Iam using access 2000 on win 2000 machines.
 
The Short Date Format is picked up from the client machine's regional settings

Use the Control Panel on the effected machines, or have a look for the following Registry Key:

HKEY_CURRENT_USER/Control Panel/International/sShortDate

This of course will only tell you what's going on... the solution is not to specify the "Short Date" format at all, but to use an explicit format like "dd/mm/yyyy".

Just type the format value in rather than selecting it from the drop-down.
 
Last edited:
Ive tried entering the format as dd/mm/yy and the problem reoccurs. The thing that mystify's me is that it works on some machines but not on others.

All machines in the office have had there shortdate changed to dd/mm/yy in control panel from install. I have also double checked it.

Its so annoying. You can see when debugging the variable being passed through incorrectly and there seems to be nothing you can do.
 
I have just noticed something :

On the machines that dont work, when debugging if you pass the mouse over the date type on the function declaration ie

public function daysworked (indate as date) as date

it displays todays date when it shouldnt display anything as it is supposed to be declaring the types for data in and out. again this works correctly on the other machines. I think the machines that dont work are just taking in a blank field and treating the type as an actual date() call, bizzare!!!!


Anybody got any ideas what the hell is going on here>
 
You seem to be counting the number of days worked, in which case shouldn't it be
public function daysworked (indate as date) as Integer ?
The other thought is the common References problem
 
The function basically returns the last day of a given month. It takes any date in and gives back the last date of that month. I just put days worked as an example.

Public Function LastDayMonth(today As Date) As Date
Dim lastday As Date
lastday = DateAdd("m", 1, today)
LastDayMonth = DateAdd("d", -1, lastday)
End Function

The function is I think sound, it just seems the difference in pc's that causes problems although they all have the same os and version of access.

What do you mean by a common reference problem?
 
The Date datatype is a fairly recent addition to VBA, I'm guessing the problem machines are using a really old version of the VBA library. In the abscence of this datatype Date would be interpreted as the function Date().

Take a look at your references, try to find out what version of the VBA dll the problem machines are running.
 

Users who are viewing this thread

Back
Top Bottom