Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 13:00 Der er 21 kommentarer og
1 løsning

Datadiff problem

Hej

Win. xp, office xp
Jeg anvender funktionen datediff uden problem i min database. Jeg har invisteret i office developer. Jeg anvender office developer til at lave en installationspakke. Denne installerer jeg på en maskine der indeholder win 95, men office xp. Så får jeg fejlen 'Function is not avalible in expression in query 'Datediff("D",date(),[opfølgningsdato])
Opfølgningsdatoen kommer ind som parameter, hvilket virker fint nok.

Jeg har på fornemmelsen, at der måske mangler en reference jeg selv skal sætte på. På win95 maskinen er der ikke nogle punkter der står som missing under references.

Hjælp

Torben
08. oktober 2002 - 13:07 #1
KOntroller referencerne (fra VBA i Tools->References) på den aktuelle maskine!

Hvis der mangler nogle referencer er det derfor (hvis der står "Missing..." ud for nogle af referencerne)
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 13:18 #2
Prøv lige at læse det sidste afsnit i mit spørgsmål....
08. oktober 2002 - 13:23 #3
sorry ;o)
Avatar billede terry Ekspert
08. oktober 2002 - 13:28 #4
Torben

Hi Torben! Are you including Access runtime in your installations pack, or is Access also installed on the win 95 PC? (Office XP)

Is the dB an MDE or MDB?

One thing I would alter was
Datediff("D",date(),[opfølgningsdato])
to
Datediff("d",date(),[opfølgningsdato])
but then it shouldnt make any difference!
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 13:38 #5
Hi Terry

The program is an MDB, no installation of Access Runtime. Office XP is installed on the win95 machine. Actually I write it
Datediff("d",date(),[opfølgningsdato])

Torben
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 13:39 #6
Eller helt korrekt:

Resterende Dage: DateDiff("d";Date();[opfølgningsdato])

I forespørgslen skal bruges ; (semikolon) istedet for , (komma)

Torben
Avatar billede terry Ekspert
08. oktober 2002 - 13:43 #7
Can you use datediff WITHOUT a parameter? and have you tried it in VBA?
If you open the debug window (Ctrl+G while in code view) and then enter
?DateDiff("d",Date(), Date()+1) for example?
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 13:52 #8
In the immediate windows your example works fine. The parameter [opfølgningsdato] was not listed in the list of parameters, but even if I entered the value, it didnt make any difference.
I tried to create a new database on the win95 machine with the exact same query (copy to clipboard). Then it works. The installation db, however is protected with users- and group settings. Maybe there is a difference...

Torben
Avatar billede terry Ekspert
08. oktober 2002 - 13:57 #9
Torben, IF you create [opfølgningsdato] as a PARAMETER you can choose the data type (date). When you do it this way then Access enusres that it IS a valid date BEFORE running the query. Not that I think this is the problem.
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 14:02 #10
I have tried that.

I just remembered something: When I use the guide to create the package, I get an error in the step just before the list of files that is included in the package. It says:
Method '~' of object '~' failed.
But I can continue and I dont have any compilation-errors, and no missing references. Therefore I just continued. I will try to make a whole new installation package...

Torben
Avatar billede terry Ekspert
08. oktober 2002 - 14:06 #11
Torben, that error you are getting makes me think that the error is actually in the Win/Office XP installation! Your getting the error on that machine I assume!
So if you do try and make a new kit then IF you get an error I would look there first!
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 14:12 #12
I tried to make a new installationpackage in the same database. I still get the error-message. I tried then to use the package-guide on another database. Here it works fine without any errors...

????
Avatar billede terry Ekspert
08. oktober 2002 - 14:19 #13
Try import ALL objects from the database into a new database.
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 14:21 #14
hehe, im already started with that...
Avatar billede terry Ekspert
08. oktober 2002 - 14:22 #15
:o)
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 14:43 #16
It seem to work. I dont get the error no more, but I have a slight problem restoring my references. I use a activex-control MSComCtl2.MonthView.2 But it is not recognized in the new database. Cant remember how I got it? Do you know?
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 14:50 #17
I find it in the toolbox (More controls) but how do I include it in the package?
Avatar billede terry Ekspert
08. oktober 2002 - 14:56 #18
I have NEVER used the setup wizard in XP but in 97 you should just add it to the list of file as you do the MDB. You obviously need to set th edestination directory to winsyspath.

BUT thiis control MAY not come from Access, which means that you may not have a license to distribute it with your kit.
I have a feeling that it comes with VB!
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 15:13 #19
The name is Microsoft Monthview control 6.0, but what is the filename?

Torben
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 15:23 #20
I found it. It is MSCOMCT2.OCX from system32

We never really found out what was wrong in the original database, but thanks to Terry for sharing my problem and helping solving it.

Torben
Avatar billede terry Ekspert
08. oktober 2002 - 15:27 #21
Is it a control you can distribute with your Access distribution kit?

Access does have unexplainable problems like this some times and quit often can be solved by importing into a new dB.

Thanks for the points :o)
Avatar billede tma_oksboel Nybegynder
08. oktober 2002 - 15:31 #22
Yes it can be distributed fine, if i include it manually by the office developer. I agree about the unexplainable problems, you first try all the logical stuff and then you try all the wird, unexplainable stuff.

Thanks again
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester