Avatar billede sup Nybegynder
17. december 2006 - 16:15 Der er 12 kommentarer og
1 løsning

Vis / Skjul kommandoknap afhængig af indhold af felt

Jeg har en underformular, som viser alle felter fra en bestemt post brugeren har klikket sig ind på. Et af mine felter i underformularen er et notatfelt som kan indeholde meget tekst eller ingen. Hvis notatfeltet indeholder data vil jeg gerne vise en knap/link, så brugeren kan klikke sig videre og se notatet.

Hvordan kan jeg skjule kommandoknappen, hvis notatfeltet ikke
indeholder nogen data?

Håber I kan hjælpe.
Sup
Avatar billede terry Ekspert
17. december 2006 - 17:42 #1
Cant youalredaysee the memo field on the form, if so what is the button supposed to do?
Avatar billede terry Ekspert
17. december 2006 - 17:42 #2
youalredaysee = you already see
Avatar billede sup Nybegynder
17. december 2006 - 18:06 #3
Hi Terry
The memo field can contain quite a big amount of text, so I choose
not to show it to keep my form nice and neat. Sometimes the memo
field is blank which is why I want to show or hide a button/link that
show a new form with the memo field.

Maybe you have a better idea?

Thx for helping out.
Sup
Avatar billede terry Ekspert
17. december 2006 - 18:13 #4
The problem with trying to hide a button on a continuous form is that when you hide on then they all (all records) get hidden.

What you could do was maybe show only the first 20 or so characters and then if the user double clicks on the field, open another form (dialog) where you show the whole text if there is any.
Avatar billede sup Nybegynder
17. december 2006 - 19:25 #5
Is it possible to make a condition for a button.

Something like:
IF(memofield <> NULL)then show button
Else
Hide the button.

Or maybe enable/disable the button depending on the condition.
Avatar billede terry Ekspert
17. december 2006 - 19:32 #6
You can try this in the forms on current event

If Len(memofield) = 0 Then
Me.YourButtonName.enabled = False
else
Me.YourButtonName.enabled = TRue

end if
Avatar billede terry Ekspert
17. december 2006 - 19:33 #7
But you will see that it effects ALL buttons
Avatar billede sup Nybegynder
17. december 2006 - 20:08 #8
Hi again terry
Thx for responding so quick.
Im a little new to Access, so im not sure where to put the code.
Where can I find "on current event" in my form?
Avatar billede terry Ekspert
17. december 2006 - 20:12 #9
you need to open the properties for the form and the press the event tab.
Avatar billede sup Nybegynder
18. december 2006 - 01:09 #10
Hey terry
You're the man. It worked with a little tweak.
Merry xmas and kind regards
Sup
Avatar billede terry Ekspert
18. december 2006 - 08:03 #11
Great, does it disable the others also?

and a Merry Xmas to you too.
Avatar billede sup Nybegynder
18. december 2006 - 10:42 #12
Hey again mr.t :)
I have a few other buttons on the form but they
dont seem to be affected.

I was thinking since each button has a unique name
the "YourButtonName" would only be affected. Does
that sound right to you?

After playing around I was thinking about using
faneblade(dont know the english name, tabs maybe)
for the memo fields I have. It would be more user
friendly I think.

But since im pretty new to Access im probably going
to ask for some more help sometime soon :)

Thx once again.
Sup
Avatar billede terry Ekspert
18. december 2006 - 13:21 #13
If it isnt a continuous form (more than one record in list) then it wont effect the other buttons (with other names).

Yes, a tab control might be an idea.

See you around :o)
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