Properties vbCrlf and CHR(13) & CHR(14) to create into a List into a Textbox (1 Viewer)

charly.csh

New member
Local time
Today, 02:18
Joined
May 7, 2020
Messages
9
Hi everyone

I hope somebody could help me with this...
I'm writing into a textbox with my code a "List of people" depending on some Checkboxes. (The name of the textbox is TeamWorktxt) and the checkboxes are WT_Quality, WT_Production, WT_Warehouse, WT_Process.

If I l click on one it adds the name of the guy responsible of the "area" and after this addition I am also using the VbCrLf to "create" an "Enter" effect... it gives the appearance into the big textbox like a "list"

The issue is when unclick on this check box an use the property REPLACE and CHR(10) or CHR(13) it deletes all the "blank" spaces and the list lose its structure. What I want is just to clean the line created or "undo" my "Enter"

I do not know if there is just a property to eliminate just a "line" and not all the blank spaces

I highly appreciate your support

My code

Please Use Code Tags:----

Code:
'****************************************
Private Sub WT_Quality_Click()

If Me.WT_Quality = -1 And Len(Me.TeamWorktxt & vbNullString) = 0 Then

Me.TeamWorktxt = DLookup("[Name]", "[TeamWork]", "[Department]= 'Quality'")

ElseIf Me.WT_Quality = -1 And Me.TeamWorktxt <> "" Then

Me.TeamWorktxt = Me.TeamWorktxt & vbCrLf & DLookup("[Name]", "[TeamWork]", "[Department]= 'Quality'")

End If

If Me.WT_Quality = 0 Then

Dim Quality As String
Quality = DLookup("[Name]", "[TeamWork]", "[Department]= 'Quality'")

'Here is my issue, I am sure if this is the best way to do this...

Me.TeamWorktxt = Replace(Me.TeamWorktxt, Quality, "")
Me.TeamWorktxt = Replace(Me.TeamWorktxt, Chr(10), "") 'Chr(10)
Me.TeamWorktxt = Replace(Me.TeamWorktxt, Chr(13), "") 'Chr(13)

End If

End Sub

'Enclosed is the example... I hope somebody could help
 

Attachments

  • Example of database list.zip
    1.2 MB · Views: 305
Last edited by a moderator:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 08:18
Joined
Jul 9, 2003
Messages
16,280
it's like you are storing data in a text box? MS Access stores data in tables.

I think you should really think about what you are doing and explain why....
 

charly.csh

New member
Local time
Today, 02:18
Joined
May 7, 2020
Messages
9
Good question!!
Basically my access app is to record customer complaints. In this textbox is just added people that participate into the problem solution of this specific complaint, I mean my main table has diffente fiels like ID, Date_Start, Date_End, Issue_Reported, and some more... one of this is "TeamWork" which include the "names of the people" working on that specific issue; such are not really important data to query further, is just to "know" who were working on it.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 08:18
Joined
Jul 9, 2003
Messages
16,280
You put the team worker participants "names of the people" in a separate table like attached. Using a subform on the main form to store the "names of the people"
 

Attachments

  • ListInA_TextboxNO_1a.zip
    28.8 KB · Views: 321

Isaac

Lifelong Learner
Local time
Today, 00:18
Joined
Mar 14, 2017
Messages
8,777
Try changing
Code:
Me.TeamWorktxt = Replace(Me.TeamWorktxt, Quality, "")
Me.TeamWorktxt = Replace(Me.TeamWorktxt, Chr(10), "") 'Chr(10)
Me.TeamWorktxt = Replace(Me.TeamWorktxt, Chr(13), "") 'Chr(13)
to
Code:
Me.TeamWorktxt = Replace(Me.TeamWorktxt, Quality & vbCrLf, "")
And it might need to be either "Quality & Chr(10)" or "Quality & Chr(13)" - you will need to debug and find out which characters actually exist in the textbox. It's probably just Chr(13), but you won't know for sure until you debug and test it.
 

charly.csh

New member
Local time
Today, 02:18
Joined
May 7, 2020
Messages
9
Hi!

Wow it is the first time I was participating in other forums, I didn´t know it could be something wrong, I meant after the rules in the post. I apologize for this and I highly appreciate the support I get from it for my knowledge. :)
 

CJ_London

Super Moderator
Staff member
Local time
Today, 08:18
Joined
Feb 19, 2013
Messages
16,607
it's not wrong to cross post, just say that you have and provide a link so responders don't waste their time providing the same answer
 

Users who are viewing this thread

Top Bottom