Results 1 to 12 of 12
  1. #1
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186

    Opposite constant of vbCrLf to "undo" the Enter

    Hi everyone



    I'm writing into a textbox with my code a "List of people" using vbCrLf to make a line space "Enter"

    Does somebody know what is the opposite of VbCrLf?

    Into my textbox when I take one data out by unclicking a checkbox... I want to go backward with this and "undo" the "Enter"

    Thanks for your support!!

    My code

    '****************************************

    If Me.WT_Engineering = 0 Then 'Checkbox

    Dim Engineering As String

    Engineering= DLookup("[Name]", "[Work_Team]", "[Departament]= 'Engineering'")

    Me.TeamWork = Replace(Me.TeamWork, Engineering, "") & vbBack 'VbBack is not returning the line back

    End If

    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    try removing CHR(10)
    and CHR(13)

  3. #3
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    Hi Ranman,

    Sorry if maybe my question is to obvious but how should be added this to my code?

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    REPLACE([field],chr(10),"")
    REPLACE([field],chr(13),"")

  5. #5
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    Thanks so much!!!!! That was exactly what I want!!!


    If Me.WT_Engineering = 0 Then 'Checkbox


    Dim Engineering As String

    Engineering= DLookup("[Name]", "[Work_Team]", "[Departament]= 'Engineering'")
    Me.TeamWork = Replace(Me.TeamWork, Engineering, "")
    Me.TeamWork = Replace(Me.TeamWork, chr(10), "")
    Me.TeamWork = Replace(Me.TeamWork, chr(13), "")
    End If

  6. #6
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    Raman
    I have a question... when I am adding three names or more to the field [TeamWork] and I unclick one... the names get all together into the textbox

    I mean when I click on the checkboxes for each deparment to add info they looks like this

    Name1
    Name2
    Name 3...

    If I only only have two names the code works incredible to add and also take out but when I add more than three names so start the issue when I take one out

    Name 1
    Name 2
    Name 3

    If I unclick on one of the checkboxes (Example unclick on "CheckBox_Name3)... The textbox [TeamWork] lost the "organization" and it looks like this:

    Name1Name2

    How could be fixed?

  7. #7
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    when I am adding three names or more to the field [TeamWork]
    That sounds like a multi value field. It is rare that you should do this, and will only cause issues unless you know how to handle them. How can your issue be fixed now? Fix your data structure or be prepared to face hurdles from now on. Suggest you research db normalization.
    The code to remove the characters as explained in your original issue does not discriminate between the first, last or any line feed/carriage return in between. The fact that you didn't foresee that proves my point. Expect more barriers as you go if using your current approach.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    Hi Micron

    My app is more related to "customer complaints" and claim has an specific record... what I am doing in this field is just to have the people that would be involved in the solution of this specific "record"

    I made this as a quick example to explain better what I am doing...

    https://www.dropbox.com/s/k280i6x53c...ist.accdb?dl=0

    any idea how to fix it?

  9. #9
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Sorry but I'm not going to provide any of my information to drop box to get your file. You should compact a copy and zip it, then post it here.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    I am sorry Micron that was not my intention

    I didn't know how to attach file into the forum

    Enclosed you can find it
    Attached Files Attached Files

  11. #11
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    You've used your spreadsheet brain to build a db. You ought to research normalization to see what I mean. One indicator of this is that if you ever need to add or remove a field you will be faced with a lot of redesign. Spreadsheets are wide, db's are tall, data is compartmentalized and then related. Using checkboxes as data input is more work than it is worth and not very flexible. Your research, if you do it, should point you to the need for a form/subform relationship for this, or at least something that doesn't store your data the way you've designed it.

    If you must follow your current approach then I'd say my first thought is to create an array, add a value to it with each check that becomes True and remove that element of the array if you uncheck it. Not an easy task for a novice.

    Or use a temp data table (not a table that gets removed/replace every time), add/remove a record for each click, then write the values to your table. But honestly, your approach is all wrong and will only complicate things as you move one step forward and two steps back at each turn.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  12. #12
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    That's a pity...
    I thought It was something easy to fix, in fact this info is not used further, is just to have some historical data who were working on that "claim record"

    Anyway in my application this is not something highly important and the data can be typed manually however I always like to have "nice" stuff into my applications

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 04-15-2020, 05:24 PM
  2. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  3. Replies: 8
    Last Post: 07-15-2014, 05:56 PM
  4. Replies: 7
    Last Post: 07-19-2013, 11:58 AM
  5. Constant "Not Responding" error
    By thart21 in forum Queries
    Replies: 2
    Last Post: 04-14-2011, 10:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums