I am using the code below to replace character strings that I create. Upon clicking a command button the character string is replaced by data from the form. This does what I need it to do.
My problem is that I have forty (40) fields on the form where I use the character strings and using this method I have to create an IF/THEN/ELSE for each of the 40 fields. (Words1 to Words40) Further when I add a new character string I have to add it to each of the 40 IF/THEN/ELSE statements.
What I am looking for is a way to look for the character strings in all 40 Words fields without using 40 IF/THEN/ELSE statements. Any help would be appreciated.
If IsNull(Words1) Then
Else
Me.Words1 = sReplace(Words1, "(*XPX*)", Nz(RLicExp, "(*XPX*)"))
Me.Words1 = sReplace(Words1, "ASSTAG", Nz(PName, "ASSTAG"))
Me.Words1 = sReplace(Words1, "RNP", Nz(RName, "RNP"))
Me.Words1 = sReplace(Words1, "ATTY", Nz(AName, "ATTY"))
Me.Words1 = sReplace(Words1, "RSTREET", Nz(RStreet, "RSTREET"))
Me.Words1 = sReplace(Words1, "TCY", Nz(RCity, "TCY"))
Me.Words1 = sReplace(Words1, "YX", Nz(RState, "YX"))
Me.Words1 = sReplace(Words1, "ZP", Nz(RZip, "ZP"))
Me.Words1 = sReplace(Words1, "(Last Name)", Nz(txtRLName, "(Last Name)"))
Me.Words1 = sReplace(Words1, "(*Month*)", Nz(txtMonth, "(*Month*)"))
Me.Words1 = sReplace(Words1, "(*Year*)", Nz(txtYear, "(*Year*)"))
Me.Words1 = sReplace(Words1, "(*Full*)", Nz(txtFullDate, "(*Full*)"))
Me.Words1 = sReplace(Words1, "(*LicType*)", Nz(txtRLicType, "(*LicType*)"))
Me.Words1 = sReplace(Words1, "(*Z3Z*)", Nz([txtNextPH], "(*Z3Z*)"))
Me.Words1 = sReplace(Words1, "(*B*D*)", Nz(txtBoardSign, "(*B*D*)"))
End If
Thanks
Accel45
My problem is that I have forty (40) fields on the form where I use the character strings and using this method I have to create an IF/THEN/ELSE for each of the 40 fields. (Words1 to Words40) Further when I add a new character string I have to add it to each of the 40 IF/THEN/ELSE statements.
What I am looking for is a way to look for the character strings in all 40 Words fields without using 40 IF/THEN/ELSE statements. Any help would be appreciated.
If IsNull(Words1) Then
Else
Me.Words1 = sReplace(Words1, "(*XPX*)", Nz(RLicExp, "(*XPX*)"))
Me.Words1 = sReplace(Words1, "ASSTAG", Nz(PName, "ASSTAG"))
Me.Words1 = sReplace(Words1, "RNP", Nz(RName, "RNP"))
Me.Words1 = sReplace(Words1, "ATTY", Nz(AName, "ATTY"))
Me.Words1 = sReplace(Words1, "RSTREET", Nz(RStreet, "RSTREET"))
Me.Words1 = sReplace(Words1, "TCY", Nz(RCity, "TCY"))
Me.Words1 = sReplace(Words1, "YX", Nz(RState, "YX"))
Me.Words1 = sReplace(Words1, "ZP", Nz(RZip, "ZP"))
Me.Words1 = sReplace(Words1, "(Last Name)", Nz(txtRLName, "(Last Name)"))
Me.Words1 = sReplace(Words1, "(*Month*)", Nz(txtMonth, "(*Month*)"))
Me.Words1 = sReplace(Words1, "(*Year*)", Nz(txtYear, "(*Year*)"))
Me.Words1 = sReplace(Words1, "(*Full*)", Nz(txtFullDate, "(*Full*)"))
Me.Words1 = sReplace(Words1, "(*LicType*)", Nz(txtRLicType, "(*LicType*)"))
Me.Words1 = sReplace(Words1, "(*Z3Z*)", Nz([txtNextPH], "(*Z3Z*)"))
Me.Words1 = sReplace(Words1, "(*B*D*)", Nz(txtBoardSign, "(*B*D*)"))
End If
Thanks
Accel45