Hello there. I am witting a program in vba/access and I have a string coming in. I need to go through the string and look for specific tags and return the rest of the line. So lets say: "I went" "to the" "park"
I need to tell the program to look for "to" and return the string "to the" The string is from a letter and I need to pick out specific lines and fill them into an forum. Thank you so much for your help!
I would say the first step is to put those lines of strings into a string array using kind of a loop. What type of loop and how to do this is kind of hard to help you with without more details.
Dim strInput() as String, intStringCount as integer
Dim strReceived as String
Dim strSearch as String, intCounter as integer
' intStringCount = 0
While ' ..............
' Read a line into your <em>strReceived</em> variable
' Code to do the above
' dimension your string array
Redim strInput(intStringCount)
' Assign that line into the array
strInput(intStringCount) = strReceived
' increment your counter
intStringCount = intStringCount + 1
WEnd ' '''''''''''''''''''''''''''''''''
' Identify your tag
strSearch = txtSearch.text
' Loop through the string Array till you find the tag
for intCounter = 0 intStringCount
' Use one of string functions like Instr, Mid$, etc to find the tag
if strSearch = txtSearch.text then
' Code to do what you need to do
exit for
Endif
next intCounter