Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011

    Unanswered: Converting text in a report

    I'm not sure this is the best way to handle this, but I have a set of data regarding training. If all the training is up to date, the data reads TFC, which represents 3 trainings. If one is missing, the letter is replaced with an X. (I didn't design the database and have no control over it, just fyi) On the report, I would like to actually spell out the training that is missing. For example, TXC would read Missing first aid.

  2. #2
    Join Date
    May 2004
    New York State
    Dim MyStr As String, strChar As String, SCntr As Integer
    MyStr = ""
    For SCntr = 1 to 3
        strChar = Mid(YourField, SCntr, 1)
        If strChar = "X" Then
            If SCntr = 1 Then MyStr = "Missing Something 1"
            If SCntr = 2 Then MyStr = "Missing Something 2"
            If SCntr = 3 Then MyStr = "Missing Something 3"
        End If
    Next SCntr
    YourField is the field you want to analyze on your form or report. If there is no X in the string, of course, it will fall through the For-Next loop altogether. Otherwise, you only need to find a way to display MyStr.


  3. #3
    Join Date
    Jul 2011
    Thank you. Unfortunately, I am completely unfamiliar with Visual Basic. Can you either give me the code for SQL or explain a little more on how to do this? Thank you so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts