Avatar billede wizzcat Nybegynder
08. august 2001 - 19:58 Der er 3 kommentarer og
1 løsning

opdater felt i tabel fra VBA

Jeg står i VB og vil skrive en streng til et felt i en tabel.
Jeg kan kalde me.xxx og få den nuværende værdi, men ikke opdatere til den nye??
hvordan gør man det.
Avatar billede terry Ekspert
08. august 2001 - 21:23 #1
wizzcat can you give more informatio.

whenn you say \"kalde me.xxx og få den nyværende værdi\" can I see your code?

Do you want to put somethng in me.xxxx?

me.xxx = 1  for numbers
me.xxx = \"Test\" for string

The field has to be \"Bound\" to the field in the table
Avatar billede wizzcat Nybegynder
08. august 2001 - 21:37 #2
I can call the me.(attribute name) and get the curent value of a field on my form, that is bound to at table. fine.

But i cannot manipulate the content and return it to the field (including updateing the underlying table.

So how do I change the value of an attribute on the form and thereby in the underlying table.?

the code goes like this but does not compile since me.context is read only

Private Sub cmdFireTalUdskift_Click()
    Dim myString As String
    myString = Me.Context
    Me.Context = ChangeNumberToText(myString)
......

wizzcat
Avatar billede terry Ekspert
08. august 2001 - 21:50 #3
me.YourFieldName = ChangeNumberToText(myString)
Avatar billede terry Ekspert
09. august 2001 - 08:28 #4
Can you enter data directly into the field without converting to text ChangeNumberToText?

The way you are doing it looks correct, but I cant see what ChangeNumberToText returns, or what the underlaying table/field looks like.

If the field in the database is a number and ChangeNumberToText returns a none numeric value then you will get an error saying that the value youenterd isnt valid for this field.
If that is the case then lookk at the function ChangeNumberToText and get it to work!
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