473,609 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to add CR/LF to a forms .value text box

19 New Member
I am trying to add the cr/lf characters to a form text box. I have used both text and a memo field that is set for Rich Text. I can add them to a string, display the string in a message box - but when I move the string to the forms field the CR/LF are being stripped out. I do not know how to overcome that. Here is a snippet of code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub ParentParcel_DblClick(Cancel As Integer)
  2. 'On Error GoTo EndSub
  3. '
  4. ''''''
  5. '
  6. ''''''
  7. Dim NewParentParcel As String
  8. Dim CurrentParentParcel As String
  9. Dim TempMapBookPage As String
  10. Dim strSQL As String
  11. Dim response As String
  12. '
  13. TempMapBookPage = "'" & MapBookPage & "'"
  14. CurrentParentParcel = ParentParcel
  15. TempMapBookPage = "'37/110'"
  16. 'MsgBox (TempMapBookPage)
  17. strSQL = "SELECT * FROM ParentParcelsTable where MapBookPage=" & TempMapBookPage & "order by ParentParcels"
  18. '
  19. Dim dbs As DAO.Database
  20. Dim rstMapQuery As DAO.Recordset
  21. '
  22. Set dbs = CurrentDb
  23. Set rstMapQuery = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
  24. '
  25. Do Until rstMapQuery.EOF
  26.     If NewParentParcel = "" Then
  27.       NewParentParcel = rstMapQuery.Fields("ParentParcels")
  28.     Else
  29.        NewParentParcel = NewParentParcel & vbCrLf & _
  30.          rstMapQuery.Fields("ParentParcels")
  31.     End If
  32.     response = MsgBox(NewParentParcel, vbYesNo)
  33.     ' after this statement I can see the parcel numbers displayed    
  34.   rstMapQuery.MoveNext
  35. '
  36. Loop
  37. '
  38. EndSub:
  39. '
  40. rstMapQuery.Close
  41. Set rstMapQuery = Nothing
  42. Set dbs = Nothing
  43. '
  44. MsgBox ("final result = " & NewParentParcel)
  45. Forms("RecordedMapsForm").ParentParcel.Value = NewParentParcel
  46. Me.Refresh
  47. '
  48. End Sub
Sep 12 '08 #1
14 5865
ADezii
8,834 Recognized Expert Expert
To add a Carriage Return/Line Feed combination to any String:
Expand|Select|Wrap|Line Numbers
  1. strAnyString & vbCrLf
Sep 12 '08 #2
cobolguy
19 New Member
Thanks ADezii for the quick reply. Please take a look at line 30. At line 46 where the data goes back to the form - they are stripped out for some reason.
Sep 13 '08 #3
ADezii
8,834 Recognized Expert Expert
Thanks ADezii for the quick reply. Please take a look at line 30. At line 46 where the data goes back to the form - they are stripped out for some reason.
Can't think of any reason why they would be. Instead of vbCrLf, you can use:
Expand|Select|Wrap|Line Numbers
  1. Chr$(13) & Chr$(10)
Sep 13 '08 #4
cobolguy
19 New Member
I have used vbNewline and the chr(n) codes as well. They all display correctly in the msgbox at ine 33, but after the statement at line 46 the strings are concatenated without the CR/LF. Maybe there is another work-around?
Sep 13 '08 #5
ADezii
8,834 Recognized Expert Expert
I have used vbNewline and the chr(n) codes as well. They all display correctly in the msgbox at ine 33, but after the statement at line 46 the strings are concatenated without the CR/LF. Maybe there is another work-around?
Type the following into the Debug Window (CTRL+G):
Expand|Select|Wrap|Line Numbers
  1. ? "Herman" & vbCrLf & "Munster"
You should see:
Expand|Select|Wrap|Line Numbers
  1. Herman
  2. Munster
Is this the case?
Sep 13 '08 #6
cobolguy
19 New Member
Hello ADezii - yes I see it (without the 1. and 2. of course). It would be nice if I could include a screenshot of the msgbox to show you.
Sep 13 '08 #7
ADezii
8,834 Recognized Expert Expert
Hello ADezii - yes I see it (without the 1. and 2. of course). It would be nice if I could include a screenshot of the msgbox to show you.
You never actually answered Post #6, do you see
Expand|Select|Wrap|Line Numbers
  1. Herman
  2. Munster
when you type ?
Expand|Select|Wrap|Line Numbers
  1. "Herman" & vbCrLf & "Munster"
  2.  
Sep 13 '08 #8
cobolguy
19 New Member
Yes - I see it in the Immediate Window as you said. Thanks.
Sep 13 '08 #9
ADezii
8,834 Recognized Expert Expert
Yes - I see it in the Immediate Window as you said. Thanks.
Try the code in a Standard Text Box and see what happens.
Sep 14 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2527
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text, radio, checkbox, and dropdown. When the form Submit button is clicked, I then need the input data either written to another location on the same page, or written to another page (a different frame would be fine)
3
5195
by: brett | last post by:
Using DOM in IE, how can I loop through FORMs and access FORM elements in a specific form? For example, www.hotmail.com has about 13 forms. I believe the one displayed is dependent on the URL. If I want to access the submit button of the visible form, which is usually the last one, how is that done? Currently, I look for type=submit using DOM but it doesn't find anything and only loops through the first FORM elements. Sorry if this...
2
2122
by: Mark Hannon | last post by:
I am designing a PayPal shopping cart/store for a client and have placed several of PayPal's shopping cart forms on the page to correspond with different products. Each form has a unique name though each of the form's elements have to use PayPal's required naming conventions to pass the data to their server. Many of the forms have hard-coded data in them and these have not caused me any problems. The problems I am having are with 3 forms...
3
4861
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be protected by forms authentication. When I create forms authentication at root level it works but when I move my code up to the subfolder I get this error: Server Error in '/TestProjects/FormsAuthenticationTestingArea' Application.
0
4216
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET Applications and owner of Access Microsystems. Doug can be reached at doug@accessmicrosystems.com. --------------------------------------------------------------------------------
7
1517
by: Sergey Poberezovskiy | last post by:
Hi, I created two base forms: frmList and frmDetail, compiled them into a dll, and then want to use in my new project. The problem: When I created new inherited form, say frmClients, I cannot load the form in design view - the IDE complains with "Argument 'Path' is Nothing or empty." error. It does not stop however the project to compile, and even
19
248116
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect this data is essential to any developer. This article is a basic tutorial on how to user HTML Forms, the most common method of data collection. Assumptions - Basic HTML knowledge. - Basic PHP knowledge. HTML Forms A common and simple way of...
5
3998
by: ankit1999 | last post by:
I have a problem, everytime i'm run this page http://click2travel.in/index.php i get the this error,,,
5
1843
by: lolodede | last post by:
i have form that contain different questions i put star for mandatory questions others left it without it then i put this java script to validate this mandatory but still ask the user to fill even the non mandatory questions and i cant submit the form why? function checkreturn1(obj) { var Invalid = false; for (i=0; i<document.getElementById("forms").length; i++) { if (document.getElementById("forms").checked) Invalid =...
5
2987
by: programmerboy | last post by:
I never had this kind of issue before and it is completely surprising. I have a usercontrol where I need 2 forms to make 1 form. When I have only 1 form it submits the page to itself. I have spent hours on this and couldn't find the solutions, thats why I have to come with a hack. I have two forms, I made the first form invisible and let the second form visible.This form is for google custom search engine. I also tried with other test forms, but...
0
8133
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8224
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7013
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6062
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5517
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4026
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1676
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1393
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.