Avatar billede idj Novice
01. november 2016 - 14:47 Der er 5 kommentarer og
1 løsning

Kan ikke bruge Format kommandoen i Tabel-Standardværdi

Jeg har en Tabel, med et Tekstfelt, hvor jeg ønsker at lagre en datolignende  værdi efter eget format yyyy.mm.dd, og har for mange år siden brugt  Format() kommandoen til det.
Den gang indsatte jeg i feltets Standardværdi efterfølgende streng, og virkede:
=Format(Year(Now());"0000") & "." & Format(Month(Now());"00") & "." & Format(Day(Now());"00")
Dette resulterede i, ved oprettelse af ny post, at feltets værdi blev  f. eks. 2016.11.01.
Nu roder jeg lidt med tabellen, men Ms Access accepterer ikke brug af Format-kommandoen.
Er der en som kan hjælpe?
Avatar billede terry Ekspert
01. november 2016 - 15:24 #1
this works here

=Format(Year(Now()),"0000") & "." & Format(Month(Now()),"00") & "." & Format(Day(Now()),"00")

I've replaced ; with , and thats it
Avatar billede terry Ekspert
03. november 2016 - 14:16 #2
?
Avatar billede idj Novice
03. november 2016 - 14:40 #3
Thanks for your help terry.
I had also tried your solution, and it failed in my Database.
I had to start with a new Database, and move all my data to the new one. A challenge, I will say, because I have well over 200000 rows with 17 columns in one table. I think I'm near the limit of my MS Access Database.
Enjoy your work ;-)
Avatar billede terry Ekspert
03. november 2016 - 15:00 #4
Hi
Are you saying that you solved the problem by moving data to new dB?

Its possible to import objects from one dB to another, normally quite easy. Did you do that?

200000 and 17 columns shouldn't be a problem for Access but it all depends on how its designed of course :-)
Avatar billede idj Novice
03. november 2016 - 15:27 #5
Hi again.
The old database didn't understand "Format" in our statement, and I also had to change widht in one column from 10 to 12, and I got the message, that MS Access did not have enough Memory for this operation.
So I started up with a new database, imported the structure of the tables. Maked the necassary changes in the structure and then imported *.csv files with all the data.
The problem was to find out what was wrong, and how to find a solution. When I had the structutere ready in the new Database, it was easy to import data.
I tried the new Database format *.accDB, but I could not get access to this from my VB6 Application, that uses my Database.
Avatar billede terry Ekspert
03. november 2016 - 15:57 #6
?
MDB also understands format!

Sounds as though the database was corrupt (not have enough Memory for this operation)...
Maybe just a straight forward compact repair would have done it.

Ages since I worked with VB6 but it should be able to uses accdb databases with it

https://www.connectionstrings.com/access/
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

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