?
Solved

Easy Peasy String question(that I have forgotten)

Posted on 2003-03-26
7
Medium Priority
?
141 Views
Last Modified: 2010-05-01
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.
0
Comment
Question by:Delboy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Expert Comment

by:trkcorp
ID: 8210655
Try like:
result = mid$(!Co_Name, 1,50) & !Co_Number
0
 
LVL 4

Accepted Solution

by:
trkcorp earned 200 total points
ID: 8210723
If that doesn't work then perhaps the data is truncated so pad it:
result = mid$(!Co_Name & Space(49), 1,50) & !Co_Number
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 8210734
= Left$(rs("Field50") & space(50), 50) & rs("Field10")
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Delboy
ID: 8210847
Second one did the job..  many thanks
0
 
LVL 5

Expert Comment

by:JohnMcCann
ID: 8210883
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

0
 
LVL 4

Expert Comment

by:trkcorp
ID: 8210945
Thanks for the points, I like paul's answer & john's would work as well...
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 8210987
:) You beat me to it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question