Problems with extracting numeric values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there

I am having a problems with extracting values from text field. I have text
field (called part number) in my access table. When I extract either in
report or email, it convert itself to date format. Example the value is
4218-06, it will change into 6/1/4218. just look like a date. anyone has any
idea or help me? Appreciate it very much.

Field is Text. Value is 4218-06

Below is my code
"Part # : " & Trim(stpn) & " Qty " & stpoqty & Chr$(13) & Chr$(13) &

Results
Part # : 6/1/4218 Qty 1
 
Hello Norhaya,

Try changing the code to:

"Part # : " & Cstr(Trim(stpn)) & " Qty " & stpoqty & Chr$(13) &
Chr$(13) &

Let me know if that helps.

Regards,

Dirk Louwers
 
Hi Dirk

I tried but still the same. :(

Dirk said:
Hello Norhaya,

Try changing the code to:

"Part # : " & Cstr(Trim(stpn)) & " Qty " & stpoqty & Chr$(13) &
Chr$(13) &

Let me know if that helps.

Regards,

Dirk Louwers
 
Well apparently somewhere along the line the value gets explicitly
interpreted as a date. Are you 100% sure that the field in the database table
is indeed a Text or Char field?
Maybe you could try debugging by the inserting:

Debug.Print varThatsSupposedToBeString

right after you have read it from the database. From the recordset for
example.
Do you read the value from a recordset directly or from a bound control?
 
You wrote that the Field name is [part number]. So what is "stpn" you used
in your expression???
 
Back
Top