jeran042
Registered User.
- Local time
- Today, 00:53
- Joined
- Jun 26, 2017
- Messages
- 127
Good afternoon all,
I am hoping someone can help me with the very beginnings of an idea.
I am trying to test the value in a form control, [POLICY], to see if it begins with "R", "R0", or 0. If it contains any of these 3 variable, I want to strip the characters away, and leave the remainder of [POLICY].
Here is what I have (very basic) for code:
What I am trying to accomplish is a DLookup on a subform. The problem is, in one table the [POLICY] is a data type "Number" and in another table the data type is "Short Text".
I should mention I was able to get the desired result with the formula:
Here is what the DLookup looks like:
NOTE: the Replace is used to strip away a carriage return in the [NOTES] field. And as of yet this is not working correctly either.
Any help or suggestions are welcome and appreciated,
I am hoping someone can help me with the very beginnings of an idea.
I am trying to test the value in a form control, [POLICY], to see if it begins with "R", "R0", or 0. If it contains any of these 3 variable, I want to strip the characters away, and leave the remainder of [POLICY].
Here is what I have (very basic) for code:
Code:
Private Sub Form_Open(Cancel As Integer)
'strip away "R", "R0", or 0 from the form control me.POLICY
'Set the value of Me.txtTEST with result
Select Case Me.POLICY
Case Left([POLICY], 1) = "R"
Me.txtTEST.value = Mid([POLICY],3,Len([POLICY])
Case Left([POLICY], 2) = "R0"
Me.txtTEST.value = Mid([POLICY],2,Len([POLICY])
Case Left([POLICY], 1) = 0
Me.txtTEST.value = Mid([POLICY],2,Len([POLICY])
Case Else
'If none of the above are TRUE, give full value of me.[POLICY]
me.txtTEST.value = Me.[POLICY].value
End Select
'Set the value of me.txtTEST with result of CASE Statement
Me.txtTEST = result
End Sub
What I am trying to accomplish is a DLookup on a subform. The problem is, in one table the [POLICY] is a data type "Number" and in another table the data type is "Short Text".
I should mention I was able to get the desired result with the formula:
Code:
=IIf(Left([POLICY],1)="R",Mid([POLICY],3,Len([POLICY])),IIf(Left([POLICY],1)=0,Mid([POLICY],2,Len([POLICY])),[POLICY]))
Here is what the DLookup looks like:
Code:
=DLookUp(Replace("NOTES",Chr(13)," "),"tblInvoiceLog","[VOUCHER_NUMBER]= " & [txtTEST] & "")
Any help or suggestions are welcome and appreciated,