Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / March 2006

Tip: Looking for answers? Try searching our database.

Putting the value of an Integer into a String ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Isis - 14 Mar 2006 18:16 GMT
I want to build a String from several fields (and other variables greated
within the VB code) some Srings some Integers is there some way of doing
something like this;

strField1 = "Your current Total is" (Field creatd within the VB code)
[InvoiceTotal] (DB Field, Integer)
strField2 = "Exclusive of Shipping" (Field creatd within the VB code)
strDisplay (Field creatd within the VB code)

Expression something like this

strDisplay = Trim(strField1) + [InvoiceTotal] + strField2

This is just an example, it is not exactly what I am doing - I know that
there are spaces missing on the Strings etc - but it is the referencing
of the Integers into an existing String that I am interested in.

Any help appreciated.

Thanks
Ken Sheridan - 14 Mar 2006 18:41 GMT
You can concatenate numeric values into a string expression without having to
convert their data type first, e.g.

Const conFirst = "Your current Total is "
Const conSecond = " Exclusive of Shipping"
Dim strDisplay As String

strDisplay = conFirst & [InvoiceTotal] & conSecond

Note that constants have been used here for the two literal strings.  There
is no need to declare these as variables as they are unchanging.  Note the
spaces at the end of the first literal string and start of the second.

Invoice Total is presumably a field in the underlying recordset  of the form
or report in whose module the code is executing.  Note that in a report's
module you can only refer to a control bound to the field, not directly to
the field in the underlying recordset as you can in a form's module.

Ken Sheridan
Stafford, England

> I want to build a String from several fields (and other variables greated
> within the VB code) some Srings some Integers is there some way of doing
[quoted text clipped - 16 lines]
>
> Thanks
Isis - 15 Mar 2006 01:30 GMT
=?Utf-8?B?S2VuIFNoZXJpZGFu?= <KenSheridan@discussions.microsoft.com>
wrote in news:5EA7D32E-C990-4EF9-BD27-029B557F468D@microsoft.com:

> You can concatenate numeric values into a string expression without
> having to convert their data type first, e.g.
[quoted text clipped - 40 lines]
>>
>> Thanks

Thanks for the reply Ken - I will give this a go.

I will actually be using variables for my text as the text will be
changed under certain circumstances - I tailored the text to make the
point.

Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.