Delboy
asked on
Easy Peasy String question(that I have forgotten)
Hi, have a field in a table which is 50 characters long and another which is 10 chars long. How would I put this into a string of 60 chars long beginning with the 50 and adding the 10 onto it without it taking out the blank chars in the 50 which are not used? for example..
"David Cassidy & Co 0000001234"
But I get..
"David Cassidy & Co0000001234"
Thanks, Derek.
"David Cassidy & Co 0000001234"
But I get..
"David Cassidy & Co0000001234"
Thanks, Derek.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
= Left$(rs("Field50") & space(50), 50) & rs("Field10")
ASKER
Second one did the job.. many thanks
In order to do this accuratly you need to declare to strings of fixed length cast your db fields into the fixed length strings and then concaternate the two strings. Something like this
Private Sub Form_Load()
Dim str1 As String * 50
Dim str2 As String * 10
str1 = "David Cassidy & Co"
str2 = "0000001234"
MsgBox str1 & str2
End Sub
Private Sub Form_Load()
Dim str1 As String * 50
Dim str2 As String * 10
str1 = "David Cassidy & Co"
str2 = "0000001234"
MsgBox str1 & str2
End Sub
Thanks for the points, I like paul's answer & john's would work as well...
:) You beat me to it.
result = mid$(!Co_Name, 1,50) & !Co_Number