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: - Private Sub ParentParcel_DblClick(Cancel As Integer)
-
'On Error GoTo EndSub
-
'
-
''''''
-
'
-
'
-
''''''
-
Dim NewParentParcel As String
-
Dim CurrentParentParcel As String
-
Dim TempMapBookPage As String
-
Dim strSQL As String
-
Dim response As String
-
'
-
TempMapBookPage = "'" & MapBookPage & "'"
-
CurrentParentParcel = ParentParcel
-
TempMapBookPage = "'37/110'"
-
'MsgBox (TempMapBookPage)
-
strSQL = "SELECT * FROM ParentParcelsTable where MapBookPage=" & TempMapBookPage & "order by ParentParcels"
-
'
-
Dim dbs As DAO.Database
-
Dim rstMapQuery As DAO.Recordset
-
'
-
Set dbs = CurrentDb
-
Set rstMapQuery = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
-
'
-
Do Until rstMapQuery.EOF
-
If NewParentParcel = "" Then
-
NewParentParcel = rstMapQuery.Fields("ParentParcels")
-
Else
-
NewParentParcel = NewParentParcel & vbCrLf & _
-
rstMapQuery.Fields("ParentParcels")
-
End If
-
response = MsgBox(NewParentParcel, vbYesNo)
-
' after this statement I can see the parcel numbers displayed
-
rstMapQuery.MoveNext
-
'
-
Loop
-
'
-
EndSub:
-
'
-
rstMapQuery.Close
-
Set rstMapQuery = Nothing
-
Set dbs = Nothing
-
'
-
MsgBox ("final result = " & NewParentParcel)
-
Forms("RecordedMapsForm").ParentParcel.Value = NewParentParcel
-
Me.Refresh
-
'
-
End Sub
14 5847
To add a Carriage Return/Line Feed combination to any String:
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.
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:
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?
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): - ? "Herman" & vbCrLf & "Munster"
You should see:
Is this the case?
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.
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
when you type ? -
"Herman" & vbCrLf & "Munster"
-
Yes - I see it in the Immediate Window as you said. Thanks.
Yes - I see it in the Immediate Window as you said. Thanks.
Try the code in a Standard Text Box and see what happens.
It works in the standard text box. It seems to work everywhere except at line 46 - where it does not work. There is something the compiler is doing to remove the CR/LF's from the stream before in goes back to the form. The form field from line 46 looks like this:
09-2-03-1-001-008.000 09-2-03-1-001-009.000 09-2-03-1-001-010.001 09-2-03-1-001-010.002
I want it to look like this:
09-2-03-1-001-008.000
09-2-03-1-001-009.000
09-2-03-1-001-010.001
09-2-03-1-001-010.002
And this is what the msgbox displays.
It works in the standard text box. It seems to work everywhere except at line 46 - where it does not work. There is something the compiler is doing to remove the CR/LF's from the stream before in goes back to the form. The form field from line 46 looks like this:
09-2-03-1-001-008.000 09-2-03-1-001-009.000 09-2-03-1-001-010.001 09-2-03-1-001-010.002
I want it to look like this:
09-2-03-1-001-008.000
09-2-03-1-001-009.000
09-2-03-1-001-010.001
09-2-03-1-001-010.002
And this is what the msgbox displays.
Would it be possible for you to send me the DB as an E-Mail Attachment? I'm currently on vacation, but the problem is that I am not running Access 2007 but when I get into work next week, I'll be more than happy to have a look at it for you. Kindly let me know one way or the other.
Thanks ADezii for the extra nice offer. I would not put you out like that. Maybe, I will continue to experiment for other work-arounds and hit on something. I'll repost if I get a solution. Thanks much.
I found a work-around for the problem. You cannot have the field on the form set for Rich Text. I deleted the field from the form. Saved/Closed the form and changed the table field from Memo to Text, size=255. Re-added the field back to the form and re-ran the same procedure. This time it produced the same results as the msgbox had been displaying all along. The Rich Text option must cause the CR/LF to be removed. I hope this helps someone else in the future.
I found a work-around for the problem. You cannot have the field on the form set for Rich Text. I deleted the field from the form. Saved/Closed the form and changed the table field from Memo to Text, size=255. Re-added the field back to the form and re-ran the same procedure. This time it produced the same results as the msgbox had been displaying all along. The Rich Text option must cause the CR/LF to be removed. I hope this helps someone else in the future.
Thanks for sharing this information with us.
Sign in to post your reply or Sign up for a free account.
Similar topics
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,,,
|
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...
|
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...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |