Solved access-VBA automaticaly add empty spaces (1 Viewer)

ubi

New member
Local time
Today, 01:57
Joined
May 28, 2021
Messages
22
Good Afternoon!

im having a strange behavior in VBA, for some reason when i try to save a combobox value to a record it changes the value saved.
The input is a combobox (Combo.0 need to change the name) with format "general number" and the record type is also a number but for whatever reason when i check it with the debug.print it automaticaly add empty spaces to the record.

Any clue of why its happening ?
 

Attachments

  • immagine_2021-06-17_171518.png
    immagine_2021-06-17_171518.png
    9.8 KB · Views: 32
  • immagine_2021-06-17_171851.png
    immagine_2021-06-17_171851.png
    44.8 KB · Views: 159
  • immagine_2021-06-17_175455.png
    immagine_2021-06-17_175455.png
    18.6 KB · Views: 159

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 16:57
Joined
Aug 30, 2003
Messages
35,471
What's the data type of the field in the table? A numeric data type can't have a space in it.
 

Minty

AWF VIP
Local time
Today, 00:57
Joined
Jul 26, 2013
Messages
8,900
I would remove the .Value qualifier personally.

Also try this

Debug.Print "Combo : " & Me.Combo0

Debug.Print "RecSet : " & rstd![Num taglio]
 

ubi

New member
Local time
Today, 01:57
Joined
May 28, 2021
Messages
22
What's the data type of the field in the table? A numeric data type can't have a space in it.
its a long integer and it indeed doesnt show the spaces on the table, but idk why it shows it has spaces on VBA
 

Minty

AWF VIP
Local time
Today, 00:57
Joined
Jul 26, 2013
Messages
8,900
The immediate window does have some interesting "features" sometimes with how it displays things.
Forcing it by adding some text can help identify if the spaces or zls or Nulls are really there.
 

ubi

New member
Local time
Today, 01:57
Joined
May 28, 2021
Messages
22
The immediate window does have some interesting "features" sometimes with how it displays things.
Forcing it by adding some text can help identify if the spaces or zls or Nulls are really there.
its true! by adding some text its now correct, so my problem is not that access randomly add some spaces xD
 

Attachments

  • immagine_2021-06-17_180927.png
    immagine_2021-06-17_180927.png
    6.6 KB · Views: 126

Users who are viewing this thread

Top Bottom