Leila,
I have a similar situation. I read values from a data input screen and then string them together into a SQL statement. I have over twenty controls to accept data and there are always nulls present. So I first create variables for each and determine if there is a null in the control or not, like this:
Code:
strReg = Nz([cboRegion].Value, "")
strSvc = Nz([cboSvc].Value, "")
strGeo = Nz([cboGeo].Value, "")
strFac = Nz([cboFac].Value, "")
strDpt = Nz([txtDept].Value, "")
So let me try to put it in your terms.
Code:
Dim strRes as String
Dim strFel as String
Dim strSpe as String
Dim strExp as String
Dim strCon as String
Dim strOth as String
Dim strStip as String
strRes = Nz([Residence in].Value, "")
strFel = Nz([Fellowship in].Value, "")
strSpe = Nz([Special Skills in].Value, "")
strExp = Nz([Experience in].Value, "")
strCon = Nz([Contractual Arrangements].Value, "")
strOth = Nz([Other Stipulations].Value, "")
strStip = Iif(Len(strRes)>0, strRes, "")
strStip = Iif(Len(strStip)>0 AND Len(strFel)>0, strStip & "; " & strFel, strFel)
strStip = Iif(Len(strStip)>0 AND Len(strSpe)>0, strStip & "; " & strSpe, strSpe)
strStip = Iif(Len(strStip)>0 AND Len(strExp)>0, strStip & "; " & strExp, strExp)
strStip = Iif(Len(strStip)>0 AND Len(strCon)>0, strStip & "; " & strCon, strCon)
strStip = Iif(Len(strStip)>0 AND Len(strOth)>0, strStip & "; " & strOth, strOth)
So now you have a string variable, strStip, with the string of concatenated values, separated by semicolons. I hope this gets your project moving.
_________________
Regards,
Marvin M
Windows 7 Professional, MS Access 2007/2010
Windows 8 Professional, MS Access 2013
-------------------------------------------------------------------------------------------------------------------
If this post has helped you, please click on the little sheriff badge in the lower left corner. Thanks!
-------------------------------------------------------------------------------------------------------------------