Avatar billede brix66 Nybegynder
17. januar 2003 - 17:26 Der er 20 kommentarer og
1 løsning

Hvis bruger taster forkert...

Hej.
Jeg har en tbl med datoer, en tbl med tidspunkter. Hvis bruger taster forkert i "Tid" feltet i frm vil jeg gerne have at der kommer en boks op, hvori der står f.eks "Dette er ikke et gyldigt tidspunkt". Jeg forestiller mig en hændelse på "lost focus" på feltet "Tid"?
Kan nogen hjælpe mig?
/Brix
Avatar billede henrik13 Nybegynder
17. januar 2003 - 17:37 #1
Hej
Får du fejlmeddelser.
Så brug hændelsen "Ved fejl"
Der indsætter du en meddelse box.
Du kan også sende den til mig.
oz1bua@wanadoo.dk
Henrik
Avatar billede terry Ekspert
17. januar 2003 - 17:37 #2
Do this in the after update event for the field.

If Not IsDate(Me.TheTimeField) Then

msgbox "Dette er ikke et gyldigt tidspunkt"
Cancel = True

end if
Avatar billede terry Ekspert
17. januar 2003 - 17:40 #3
just a small correction there!
BEFORE UPDATE event

You set the cancel field to TRUE which will automatically place the cursor BACK into the field.
Avatar billede terry Ekspert
17. januar 2003 - 17:44 #4
a TIME value can only be validated as being a DATE so what you could do id append the time value onto the current date to make it into a Date/time

EXAMPLE

If Not isdate(Date() & " " & Me.TheTimeField) Then ......
Avatar billede terry Ekspert
17. januar 2003 - 17:46 #5
this should not be necessary though!
Avatar billede brix66 Nybegynder
17. januar 2003 - 17:48 #6
Ikke så stærkt - jeg prøver at teste....
Men jeg kan se at dato feltet og tid feltet ligger i en underformular.
Avatar billede terry Ekspert
17. januar 2003 - 17:51 #7
It doesnt matter if these fields are in a sube form, you place the code in the FIELDS before update event NOT the forms.
Avatar billede brix66 Nybegynder
17. januar 2003 - 17:55 #8
Tusind tak, det virker....
Jeg brugte den i svar 17:37:49 + jeg har sat cancel til false.
Men kan jeg ikke få cursor til at vende tilbage til tomt tid felt? Nu går den til dato feltet?
/Brix
Avatar billede terry Ekspert
17. januar 2003 - 17:55 #9
I assume it worked?

and thanks :o)
Avatar billede terry Ekspert
17. januar 2003 - 17:57 #10
didnt see you last comment! Nice to hear it worked :o)

Well I cant see exactly which field you are testing on, but you might be able to use me.TheTimeField.setfocus
Avatar billede terry Ekspert
17. januar 2003 - 18:07 #11
brix66, I dont think you will be able to use me.TheTimeField.setfocus!

If you enter a time then you should have some code to check that field and also some code to check the date field.
Cancel = True will place the cursor in the field you just tried leaving (after entering some data).
Avatar billede brix66 Nybegynder
17. januar 2003 - 18:10 #12
What if I send you the DB? If you promise to keep it confidentional?
/Brix
Avatar billede brix66 Nybegynder
17. januar 2003 - 18:12 #13
I´ve gone eating. Be back soon......
/Brix
Avatar billede terry Ekspert
17. januar 2003 - 18:15 #14
No problem, terry@santhell.dk
Avatar billede terry Ekspert
17. januar 2003 - 18:34 #15
brix, if you do send the dB then I WILL look at it, but it may not be until tomorrow morning. I'm also off for something to eat (and some wine :o) )
Avatar billede brix66 Nybegynder
17. januar 2003 - 19:03 #16
I will work on it this evening and if it dosn't work tomorrow morning I'il send it to you then.
Sounds almost "like" a "if", "then", "go to", dosn't it?
Plesant evening...
/Helle
Avatar billede terry Ekspert
18. januar 2003 - 11:19 #17
Is there something wrong with this question? I cant see any comments!
brix are you having the same problem?
Avatar billede brix66 Nybegynder
18. januar 2003 - 11:50 #18
Yes....
Avatar billede terry Ekspert
18. januar 2003 - 11:57 #19
can you remember what you said in your last comment(17/01-2003 19:03:57)

You can send your db to terry@santhell.dk and I will take a look.
Avatar billede brix66 Nybegynder
18. januar 2003 - 11:58 #20
By the way... It didn't work quite as good as I expected. It seems to give me the msgbox either way... So I was thinking of sending you the db after all. Are you up for it now? And why are we writing in english? Your mail again, please. The db is in 2002. Don't mind my spelling and english.
/Brix
Avatar billede brix66 Nybegynder
18. januar 2003 - 12:00 #21
Our last comment seems to have crossed each other. I'll send it in a minute...
/Brix
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