Avatar billede klk Nybegynder
26. september 2008 - 09:58 Der er 9 kommentarer og
1 løsning

Højrejusterede priser i en alm. tekstboks

Hej Access eksperter!
Jeg skal udfylde en tekstboks ud fra nogle kriterier, som brugeren har valgt i et par kombinationsbokse. Tekstboksen er bundet til et tabelfelt af datatypen "Notat", så der er god plads. Jeg udfylder tekstboxen ved hjælp af VB kode. Tekstboksen indeholder et standard tilbud bestående af forskellige "varelinier" med hver deres pris, og jeg skal så summere priserne i bunden. Det går også fint, men jeg kan ikke få priserne til at stå pænt under hinanden. Kan man lave en højrejusteret tabulator som i Word, eller bruge en tilsvarende løsning?
Avatar billede terry Ekspert
26. september 2008 - 11:33 #1
!!!
Are you saying that you use a memo field to show "varelinier"?

Why dont you make a report and show the information, this will give you much more control
Avatar billede klk Nybegynder
26. september 2008 - 14:25 #2
Because I do not see any possibility of giving the wantet choices if I generate a report.

The user should have 2 choices:
1. To copy the content from the Memobox by pressing a button
2. To Press the "Send e-mail" button which fires the command  DoCmd.SendObject ....
Avatar billede terry Ekspert
26. september 2008 - 15:44 #3
Avatar billede klk Nybegynder
29. september 2008 - 09:29 #4
I can not get it up and running. I tried to convert the mdb to 2003, but it did not help. If I compile the Class Module "CommonDialog" an error commes up in line:
strStyle = Space(100)
Compile Error: Can't find project or library.
If I press OK it shows a list of available references. The name of the window is:
Reference - RTF.

I think I need the Richtx32.OCX:
    If GetSetting("FormatteretMemo", "ActiveX", "RTF_Registered", False) = True Then Exit Function
    Sti = GetSpecialPath(TJ_SYSTEM)
    Call Shell(Sti & "\regsvr32.exe " & Sti & "\RICHTX32.OCX", WIN_NORMAL)
Avatar billede klk Nybegynder
29. september 2008 - 09:48 #5
I downloaded Richtx32.ocx from Ocxdump.com.

Does not work. It says:
DllRegisterServer i C:\windows\system32\richtx32.ocx mislykkedes. Returkoden var:
0x8002801c
Avatar billede klk Nybegynder
29. september 2008 - 09:55 #6
Sorry, I am not loggen on as adminstrator. I try again and leave a message about the result
Avatar billede klk Nybegynder
29. september 2008 - 10:25 #7
That worked.

But the form starts with an error:
Der er intet objekt i dette kontrolelement

Pressing a button gives:
Udtrykket VedKlik (...) gav en fejl:
Object or class does not support the set of events.
Avatar billede klk Nybegynder
29. september 2008 - 10:42 #8
Thank you I found the meening of the example:

The answer is:
Try to use the TextAlign property.

The following example aligns the text in the "Address" text box on the "Suppliers" form to the right.
Forms("Suppliers").Controls("Address").TextAlign = 3
Avatar billede terry Ekspert
29. september 2008 - 11:00 #9
thanks
Avatar billede klk Nybegynder
22. oktober 2008 - 09:39 #10
That did not help because I have some leading text describing the orderline which is left aligned with fixed character length, and then a price for that orderline which is right aligned. The price can have different amount of characters depending on how low or high the price is. Eksample: 100,00 = 6 characters. 1000,00 = 7 characters. Then the space between the leading text and the price differs between the different proposals.

Solution:
To be sure all characters in the lines is aligned exactly beneith each other, i have choosen the font Courier as text format in the textbox. Then I wrote some code for each orderline (the following code is an example for one line).

  Text_THC = Text7
  Text_Final_THC = Format(Var_THC, "0.00")  'Var_THC were earlier selected in a table
  Len_THC = Len(Text7)
  Len_Final_THC = Len(Text_Final_THC)
  Spaces_THC = 73 - Len_THC - Len_Final_THC

  ProposalText =  Text_THC + String(Spaces_THC, " ") + Text_Final_THC

Then I put in the wright amout of spaces every time.
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