Avatar billede petersen7913 Forsker
21. januar 2008 - 14:52 Der er 11 kommentarer og
1 løsning

At fange første record når man skifter til et nyt faneblad

Jeg har en formular med nogle faneblade. Jeg kan godt fange, at jeg skifter til et nyt faneblad (_click og _change), men jeg har brug for at fange om den record man automatisk står på er tom eller ej.

Hvis det er en tom/ny record skal man nemlig ikke kunne klikke sig videre, hvis det er en eksisterende record kan man klikke videre og se detaljerede oplysning osv.

Jeg har prøvet med me.name, men det giver (kun) formularen.
Avatar billede terry Ekspert
21. januar 2008 - 15:00 #1
Try using
IsNull(Me.ID)
Where ID is the primary key in the form.
Avatar billede hugopedersen Nybegynder
22. januar 2008 - 07:47 #2
If Me.NewRecord = True fanger om du er ved at oprette en ny record
Avatar billede petersen7913 Forsker
22. januar 2008 - 10:14 #3
Jeg kan ikke få det til at virke.

Cusoren står og blinker i det første felt, men jeg kan ikke spørge på det.
Hvis jeg bruger me.OrderID får jeg Method or datamamber not found.

Jeg har forsøgt med Tab.Value.OrderID, virker heller ikke. Jeg vil gætte på at jeg burde bruge Tab.Value til et eller andet, men hvad?
Avatar billede terry Ekspert
22. januar 2008 - 17:32 #4
any chanc eof seeing the dB?
ekspertenATsanthell.dk

AT = @
Avatar billede terry Ekspert
23. januar 2008 - 10:10 #5
If Len(Me.tbCurrentOrderID) = 0 Then Exit Sub
Avatar billede petersen7913 Forsker
23. januar 2008 - 11:01 #6
Oh yes, it works :-) but it's not good enough (only for a demo)

But it is impossible to get what field I'm actually in? I mean, the cursor IS in the field, I know the form, I know the Tab.Value so how do I get the field itself?
Avatar billede terry Ekspert
23. januar 2008 - 11:14 #7
?
I'm not sure what you mean. If the record you are on is empty then the button doesnt open th eform which shows the record in detail.

It also (I think) works if you change which TAB you are on.

Can you explain in more detail?
Avatar billede petersen7913 Forsker
23. januar 2008 - 11:57 #8
Yes, your solution works if the record is empty and it works if I change to another tab.

But I have 2 reasons why I want to know this: 1) I like to learn ;) so I can use this lesson somewhere else, and 2) I like to make it easy for my users. So if they opens the formular and are standing at the right record (not empty) from the beginning, then they can just pres the button and go to the next formula. As it is now they'll have to click! somewhere in the record and then use the button.

So my question is: how do I know which field on the tab is the cursor located at? And I think this will be nice for me to know i a lot of other situations as well.
Avatar billede terry Ekspert
23. januar 2008 - 12:24 #9
I understand you want to learn, I do too, but I wasnt, and maybe still arent sure what exactly you want to do.

Do you want to be able to double click on an existing record and open the other form without having to click the button?
Avatar billede terry Ekspert
23. januar 2008 - 12:25 #10
I think you might be confusing things when you mention another form and another tab control!
Avatar billede petersen7913 Forsker
23. januar 2008 - 15:21 #11
terry, I can see my explanations are confusing, sorry. And I can see that my problem has changed as part of it is solved and then I have a new way of seeing the problem, well that's part of the learningprocess ;)

So I something that works allthough I would like it to work a little bit different. Let's close this quation and again, thanks for your help :)
Avatar billede terry Ekspert
23. januar 2008 - 15:26 #12
Thanks, I'll send a comment to your email.
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