Hello, esteemed experts!
I have a RTF field called "TxtMedications " that contains multiple lines of text, each of these obviously preceded by a <div> tag. For example:
Lacosamide 200 mg bid
Divalproex ER 1500 mg qhs
Pregabalin 50 mg q8h
Ibuprofen 400 mg tid PRN
Cetirizine 10 mg daily PRN
Or in string form...
<div>Lacosami de 200 mg bid</div>
<div>Divalpro ex ER 1500 mg qhs</div>
<div>Pregabal in 50 mg q8h</div>
<div>Ibuprofe n 400 mg tid PRN</div>
<div>Cetirizi ne 10 mg daily PRN</div>
What I'm trying to do (and where I'm currently stuck) is separating out all lines which contain the string "PRN" into another RTF text box, called "TxtPRNMeds " and having the remainder put into a RTF text box called "TxtScheduledMe ds".
I'm able to use the InStr() and Mid() functions to return the first string of text between the tags and search that string for "PRN".
So in the above, I'm able to isolate the string "Lacosamide 200 mg bid" and determine that it does not contain the matching string "PRN" but that's about as far as I've gotten to this point. Any advice on how to search the subsequent rich text lines?
Thanks for any help.
Signed,
Perplexed
I have a RTF field called "TxtMedications " that contains multiple lines of text, each of these obviously preceded by a <div> tag. For example:
Lacosamide 200 mg bid
Divalproex ER 1500 mg qhs
Pregabalin 50 mg q8h
Ibuprofen 400 mg tid PRN
Cetirizine 10 mg daily PRN
Or in string form...
<div>Lacosami de 200 mg bid</div>
<div>Divalpro ex ER 1500 mg qhs</div>
<div>Pregabal in 50 mg q8h</div>
<div>Ibuprofe n 400 mg tid PRN</div>
<div>Cetirizi ne 10 mg daily PRN</div>
What I'm trying to do (and where I'm currently stuck) is separating out all lines which contain the string "PRN" into another RTF text box, called "TxtPRNMeds " and having the remainder put into a RTF text box called "TxtScheduledMe ds".
I'm able to use the InStr() and Mid() functions to return the first string of text between the tags and search that string for "PRN".
Code:
Dim strAllMeds As String Dim strSearch As String strAllMeds = Me.TxtMedications strSearch = Mid(strAllMeds, InStr(1, strAllMeds, "<div>", vbTextCompare) + 5, InStr(1, strAllMeds, "</div>", vbTextCompare) - 6) If InStr(1, strSearch, "PRN", vbTextCompare) > 0 Then 'Add to TxtPRNMeds Else 'Add to TxtScheduledMeds End If
Thanks for any help.
Signed,
Perplexed
Comment