Avatar billede r_becker Novice
12. januar 2003 - 16:58 Der er 19 kommentarer og
1 løsning

lave om i en formular

hej kan man i en formular lave feks et nummer felt om så der i formularen bliver vist noget tekst.
lidt lige som man gør i en rapport med select case
Avatar billede mugs Novice
12. januar 2003 - 17:21 #1
Hvis du f.eks har en tekstboks af typen Tal, og du vil tælle antal poster i Tabel1 ser det således ud i feltets postkilde:

=DCount("*";"Tabel1")

Hvis du vil have tilføjet en forklarende tekst kan det se ud sådan:

="Der er:" & DCount("*";"Tabel1")

Husk at tekst skal være i "", og bind dine udtryk sammen med &
Avatar billede terry Ekspert
12. januar 2003 - 17:29 #2
if the field is BOUND to a field in a table then you will get an error if you try entering text. If the field is not BOUND to a table then you can enter what you like.
Avatar billede terry Ekspert
12. januar 2003 - 17:30 #3
what are you trying to do?
Avatar billede r_becker Novice
12. januar 2003 - 17:31 #4
jeg har nogle talværdier fra en gruppeboks
som jeg gene ville have vist som noget andet.

hvis man kan lave dem inden jeg gemmer dem i min tabel ville det være endnu bedere.
feks: 1 fra min gruppeboks bliver gemt som null
      2 fra min gruppeboks bliver gemt som St Tv
      3 --------------"--------------- som St M
      4 --------------"--------------- som st Th
Avatar billede terry Ekspert
12. januar 2003 - 17:39 #5
r_becker, I think your best bet i sto normalize your database!

You have a table with primary key (values 1 to 4)
Then a text field containing the text value. THen if you continue using the group box you can alter the form to show an extra field containing the text.
You will need to alter the record source for the form to a query which contains the extra text field

This is the new table
1, Null
2, St Tv
3, St M
4, St Th
Avatar billede mugs Novice
12. januar 2003 - 17:41 #6
Feltet i tabellen der modtager værdien skal være en tekstboks. Træk feltet ind i din forespørgsel / formular. Når du laver din gruppeboks skal du lade gruppeboksen returnere værdien til dette felt. I Gruppeboksen laver du denne kode i VedKlik:

Select Case Ramme2
Case Is = 1
Me.felt1 = "St. tv"
Case Is = 2
Me.felt1 = "St. th"
Case Is = 3
Me.felt1 = "1. tv"
End Select

Kan sende en testdb. Læg din e-mail
Avatar billede terry Ekspert
12. januar 2003 - 17:43 #7
i sto normalize = is to normalize

At the moment you have a numeric field containing the value selected from the Group Box. Make the new table as I mention, and then alter the field containing the value from the group box from a numeric value to a Lookup. This makes a relationship from the original table to the new table which contains the text values.

Hope it all makes sence!
Avatar billede terry Ekspert
12. januar 2003 - 17:45 #8
mugs> your answer WILL give r_becker what she wants, but it isnt th ecorrect way to do things. You will be creating redundance which is what relationla databases tries to avoid :o)
Avatar billede r_becker Novice
12. januar 2003 - 17:49 #9
mugs Rickie@skeeknejde.dk som zip

terry ikke rigtigt (o;


rickie
Avatar billede mugs Novice
12. januar 2003 - 17:50 #10
terry > Your are 100% right.
I have seen the DB, and I have for some dayes ago told the user, that he should redesign the db.

I have sent a db conjerning my answer, and again told him, that he should think using your solution. Here the text from My e-mail:

Jeg har jo din e-mail.
Men jeg ville nok overveje terry's forslag, men det kræver lidt mere
kendskab til VBA.
/mugs
Avatar billede terry Ekspert
12. januar 2003 - 17:55 #11
mugs>After seeing the dB can you tell me if it should be resonably easy to make the alterations (new table) as I suggest or not? I dont want to commit myslef if it would take ages to alter :o)

r_becker, I would be prepared to take a look at the dB and make the alterations if its something which isnt going to take too long. Otherwise I would use mugs' idea.
Avatar billede mugs Novice
12. januar 2003 - 17:59 #12
terry > I think it will take just a few minutes.

As far as I remenber the DB is Access2000 og XP. I have access97, and when I opened the DB, there was a few malfunctions I think was from the "konvertering"
Avatar billede r_becker Novice
12. januar 2003 - 18:00 #13
terry  hvis du vil så må du meget gerne se den, hvis du mener det vil tage for lang tid kan du jo bare sige det og så må jeg jo prøve det som mugs siger.
Rickie
Avatar billede terry Ekspert
12. januar 2003 - 18:02 #14
OK, eksperten@santhell.dk

I need to know which form to look at.
Avatar billede terry Ekspert
12. januar 2003 - 18:07 #15
mugs>your going to have to get hold of XP :o)
Avatar billede r_becker Novice
12. januar 2003 - 18:09 #16
er sendt
går lige ned og for noget at æde
Avatar billede terry Ekspert
12. januar 2003 - 18:10 #17
I have received your dB. Will get back as soon as possible, but first I'm just going to have something to eat :o)
Avatar billede r_becker Novice
12. januar 2003 - 19:58 #18
point til Terry
det var lige det sådan jeg hade tænkt det skulle være
hvordan fik du den til at fylde så lidt.
Avatar billede terry Ekspert
12. januar 2003 - 20:10 #19
well I tried to compress the dB but got an error. So I made a new dB and copied all objects into it.

Hope you can see how it works.
Avatar billede terry Ekspert
12. januar 2003 - 20:12 #20
If you want to ALTER data in the grid then you will need to change the "etage" field to a combo so that you can choose which type you want.
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