PC Review


Reply
Thread Tools Rate Thread

Concatenating a text box with possible null values

 
 
=?Utf-8?B?RE1haW5sYW5k?=
Guest
Posts: n/a
 
      24th Aug 2005
I am using a simple text box to return a Plaintiff vs. Defendant title
("Black vs. White") on a report. I would like to know how I can concatenate
the fields to
give me not only the Plaintiff vs. Defendant but would also return a Co
Plaintiff and a 2nd CoPlaintiff, and a Co Defendant and a 2nd Co Defendant or
any combination thereof, in the event I have a case including a combination
of multiple parties. I hope I am making myself clear.

The names of plaintiff, co-plaintiff, 2nd co-plaintiff, defendant,
co-defendant, and 2nd co-defendant are entered into separate tables joined by
a common docket number (autonumber).

Any help would be greatly appreciated.
--
DMainland

--
DMainland
 
Reply With Quote
 
 
 
 
Tim Ferguson
Guest
Posts: n/a
 
      24th Aug 2005
=?Utf-8?B?RE1haW5sYW5k?= <(E-Mail Removed)> wrote in
news:C913156C-CC0D-42DD-A783-(E-Mail Removed):

> I am using a simple text box to return a Plaintiff vs. Defendant title
> ("Black vs. White") on a report. I would like to know how I can
> concatenate the fields to
> give me not only the Plaintiff vs. Defendant but would also return a
> Co Plaintiff and a 2nd CoPlaintiff, and a Co Defendant and a 2nd Co
> Defendant or any combination thereof, in the event I have a case
> including a combination of multiple parties. I hope I am making
> myself clear.
>
> The names of plaintiff, co-plaintiff, 2nd co-plaintiff, defendant,
> co-defendant, and 2nd co-defendant are entered into separate tables
> joined by a common docket number (autonumber).


GUI method (easiest to implement and probably faster if you have large
number of rows): create a subreport getting names out of the Litigants
table with suitable ChildField and ParentField fields.

VBA method: create a procedure that reads a suitable query and iterate it
to create the string. You can call this in the OnFormat event (I think)
and insert the formatted text into the control. It needs to be highly
optimised unless it only has to run a few times. Try something like

Private Function GetLitigants( _
CaseNum as Long, _
IsDefendant as Boolean _
) As String


Dim output as String
DDim qdf as Querydef ' this is DAO, but you can
Dim rs as Recordset ' the similar thing in ADO

' open the query and provide its parameters
Set qdf = QueryDefs("GetLitigants")
With qdf
' details of the query obviously depend on your local
' table design etc etc. Don't forget to sort them
' suitably!
.Parameters("CaseNum") = CaseNum
.Parameters("Type") = Iif(IsDefendant,"Def","Plf")
' forward only snapshot is fastest and we need speed!
Set rs = .OpenRecordset(dbOpenSnapshot, dbForwardOnly)
End With

' read the names and concatenate them
Do While Not rs.EOF
' punctuation
If Len(output)>0 Then output = output & ", "
' read
output = output & rs!FullName
' don't want infinite loop!
rs.MoveNext
Loop

' all done, tidy up
rs.Close
qdf.close

GetLitigants = output

End Function


which is air code and completely untested, but you get the picture.

Hope that helps


Tim F

 
Reply With Quote
 
 
 
 
David C. Holley
Guest
Posts: n/a
 
      25th Aug 2005
Here's something to get you started. You'll have to adapt it to the
specific of you DB which I didn't have access to. (Evidently the court
order to turn over that information was misfiled.) I'm assuming that you
have some way of designating if a person is a plaintif or defendant. If
there are no plaintifs or defendants, the result will be [v. ],
otherwise the result should list out the formal title.

function getCaseTitle(strDocketNumber as String)

strSQL = "SELECT field1, field2, field3 FROM tblParties WHERE type =
'Defendant';"

Set db = currentDb()
'Get defendants
Set rs = CurrentDB.OpenRecordSet(strSQL, dbOpenForwardOnly)

getCaseTitle = ""

While NOT rs.EOF
If flgAddComma = True then
getCaseTitle = getCaseTitle & ", " & rs("fieldName")
else
getCaseTitle = getCaseTitle & rs("fieldName")
end If
flgAddComma = True
rs.MoveNext
Wend
rs.close

'Get plaintifs
strSQL = "SELECT field1, field2, field3 FROM tblParties WHERE type =
'Plaintif';"
Set rs = CurrentDB.OpenRecordSet(strSQL, dbOpenForwardOnly)

fglAddComma = False
getCaseTitle = getCaseTitle & " v. "

While NOT rs.EOF
If flgAddComma = True then
getCaseTitle = getCaseTitle & ", " & rs("fieldName")
else
getCaseTitle = getCaseTitle & rs("fieldName")
end If
flgAddComma = True
rs.MoveNext
Wend

rs.close
Set rs = Nothing
Set db = Nothing

end fucntion

DMainland wrote:
> I am using a simple text box to return a Plaintiff vs. Defendant title
> ("Black vs. White") on a report. I would like to know how I can concatenate
> the fields to
> give me not only the Plaintiff vs. Defendant but would also return a Co
> Plaintiff and a 2nd CoPlaintiff, and a Co Defendant and a 2nd Co Defendant or
> any combination thereof, in the event I have a case including a combination
> of multiple parties. I hope I am making myself clear.
>
> The names of plaintiff, co-plaintiff, 2nd co-plaintiff, defendant,
> co-defendant, and 2nd co-defendant are entered into separate tables joined by
> a common docket number (autonumber).
>
> Any help would be greatly appreciated.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Empty text values aren't null or zero-length, but 2-byte null (\x0000) Mark Steward Microsoft Access 2 21st Jan 2006 03:03 PM
Null text box fields when group heading is null Richard Harison Microsoft Access Reports 8 1st Jul 2005 01:24 PM
Concatenating fields that may contain NULL Craig Microsoft ASP .NET 2 22nd Oct 2004 08:59 PM
Concatenating Fields With Possible Null Values Robert Gruenloh Microsoft Access ADP SQL Server 5 26th Feb 2004 11:59 PM
Null result when combining null field with non-null field in ADP View Lauren Quantrell Microsoft Access Form Coding 8 17th Nov 2003 03:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:23 AM.