Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert numeric to text

Status
Not open for further replies.

Geraldo

Programmer
Mar 18, 2002
37
0
0
PT
how can i convert a numeric or $ field to text

i need to do that in order to perform a search.

 
You can use CStr(int) converts int to String

eg.

Dim intInt As Integer
Dim intInt2 As Integer
intInt2 = 20
intInt = 10

MsgBox CStr(intInt) + CStr(intInt2)
'Returns '1020' as string

MsgBox intInt + intInt2
'Returns 30 as int

There are two ways to write error-free programs; only the third one works.
 
i´m sending the code for with the problem
when i put the value in the value control in a form the i execute this code.
if works for every fields in exception for the currency field (VValor).
i used CSTR but it didn´t work too, i put in the form control de value 500 and it works but if i put the value 500,22 an error happens

Dim MyDatabase As DATABASE
Dim MyQueryDef As QueryDef
Dim where As Variant

Set MyDatabase = CurrentDb()

If ObjectExists("Queries", "Q-Listagens Banco") = True Then
MyDatabase.QueryDefs.Delete "qryDynamic_QBF"
MyDatabase.QueryDefs.Refresh
End If
where = Null
where = where & " AND [Banco]= '" + Me![Banco] + "'"
where = where & " AND [Movimento]= '" + Me![Movimento] + "'"
where = where & " AND [MES]= '" + Me![PMês].Column(1) + "'"
where = where & " AND [ANO]= '" + Me![Ano].Column(0) + "'"
THIS IS MY PROBLEM
where = where & " AND [VValor]= " + CStr(Me![VValor])

Set MyQueryDef = MyDatabase.CreateQueryDef("qryDynamic_QBF", _
"Select * from [Q-Listagens Banco] " & (" where " + Mid(where, 6) & ";"))

DoCmd.OpenReport "R-BancosProcura", acViewPreview
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top