473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Concatenating text fields with a WHERE condition

I have a problem using Dev Ashish's excellent module to concatenate the
results of a field from several records into one record.

I am using the code to concatenate certain awards onto a certificate at the
end of the year. I have the code working fine, except for the fact that
when I want to restrict the entries to awards between certain dates, even
though I can use the restriction in the query that shows the actual records,
when the fConcatChild function runs, it picks up all the entries, regardless
of the date restriction. I tried to run the table part as a qry rather than
a tbl, but no joy. I think the code inside Dev's module will need to get
have the date restriction in it. I need the type of restriction that is
WHERE Date >start date <End date.

Does anyone know how to do that within the module.
The code in that module is beyond my expertise.

The code I have is as follows:
***************************************
Function fConcatChild(strChildTable As String, _
strIDName As String, _
strFldConcat As String, _
strIDType As String, _
varIDvalue As Variant) _
As String
'Returns a field from the Many table of a 1:M relationship
'in a semi-colon separated format.
'
'Usage Examples:
' ?fConcatChild("Order Details", "OrderID", "Quantity", _
"Long", 10255)
'Where Order Details = Many side table
' OrderID = Primary Key of One side table
' Quantity = Field name to concatenate
' Long = DataType of Primary Key of One Side Table
' 10255 = Value on which return concatenated Quantity
'
Dim db As Database
Dim rs As Recordset
Dim varConcat As Variant
Dim strCriteria As String, strSQL As String
On Error GoTo Err_fConcatChild

varConcat = Null
Set db = CurrentDb
strSQL = "Select [" & strFldConcat & "] From [" & strChildTable & "]"
strSQL = strSQL & " Where "

Select Case strIDType
Case "String":
strSQL = strSQL & "[" & strIDName & "] = '" & varIDvalue & "'"
Case "Long", "Integer", "Double": 'AutoNumber is Type Long
strSQL = strSQL & "[" & strIDName & "] = " & varIDvalue
Case Else
GoTo Err_fConcatChild
End Select

Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

'Are we sure that 'sub' records exist
With rs
If .RecordCount <> 0 Then
'start concatenating records
Do While Not rs.EOF
varConcat = varConcat & rs(strFldConcat) & vbCrLf
.MoveNext
Loop
End If
End With

'That's it... you should have a concatenated string now
'Just Trim the trailing ;
fConcatChild = Left(varConcat, Len(varConcat) - 2)

Exit_fConcatChild:
Set rs = Nothing: Set db = Nothing
Exit Function
Err_fConcatChild:
Resume Exit_fConcatChild
End Function
***************************

Apart from trying to get this module to do as I wish it, I had though of
using a maketable query to put the entries I wish to use into a temporary
table, then running this function on that data, but it would be nice to know
how to modify the module with a restriction.

TIA
Dixie
PS sorry about the length of this post.
Nov 13 '05 #1
16 3024
You have to pass the StartDate and EndDate into the function, so it
should look like this:

Function fConcatChild(strChildTable As String, _
strIDName As String, _
strFldConcat As String, _
strIDType As String, _
varIDvalue As Variant _
dtmStart As Date, _
dtmEnd As Date, _
As String
'--Function body (mostly omitted for brevity!)
End Function

then after this:

Select Case strIDType
Case "String":
strSQL = strSQL & "[" & strIDName & "] = '" & varIDvalue &
"'"
Case "Long", "Integer", "Double": 'AutoNumber is Type Long
strSQL = strSQL & "[" & strIDName & "] = " & varIDvalue
Case Else
GoTo Err_fConcatChild
End Select

You need to drop in the date filtering part of the WHERE clause
strSQL = strSQL & " AND [SomeDate] BETWEEN #" & dtmStart & "# AND #" &
dtmEnd &"#"

see? nothing to it, right?

Nov 13 '05 #2
Dixie wrote:
I have a problem using Dev Ashish's excellent module to concatenate the
results of a field from several records into one record.

I am using the code to concatenate certain awards onto a certificate at the
end of the year. I have the code working fine, except for the fact that
when I want to restrict the entries to awards between certain dates, even
though I can use the restriction in the query that shows the actual records,
when the fConcatChild function runs, it picks up all the entries, regardless
of the date restriction. I tried to run the table part as a qry rather than
a tbl, but no joy. I think the code inside Dev's module will need to get
have the date restriction in it. I need the type of restriction that is
WHERE Date >start date <End date.

Does anyone know how to do that within the module.
The code in that module is beyond my expertise.

The code I have is as follows:
***************************************
Function fConcatChild(strChildTable As String, _
strIDName As String, _
strFldConcat As String, _
strIDType As String, _
varIDvalue As Variant) _
As String
'Returns a field from the Many table of a 1:M relationship
'in a semi-colon separated format.
'
'Usage Examples:
' ?fConcatChild("Order Details", "OrderID", "Quantity", _
"Long", 10255)
'Where Order Details = Many side table
' OrderID = Primary Key of One side table
' Quantity = Field name to concatenate
' Long = DataType of Primary Key of One Side Table
' 10255 = Value on which return concatenated Quantity
'
Dim db As Database
Dim rs As Recordset
Dim varConcat As Variant
Dim strCriteria As String, strSQL As String
On Error GoTo Err_fConcatChild

varConcat = Null
Set db = CurrentDb
strSQL = "Select [" & strFldConcat & "] From [" & strChildTable & "]"
strSQL = strSQL & " Where "

Select Case strIDType
Case "String":
strSQL = strSQL & "[" & strIDName & "] = '" & varIDvalue & "'"
Case "Long", "Integer", "Double": 'AutoNumber is Type Long
strSQL = strSQL & "[" & strIDName & "] = " & varIDvalue
Case Else
GoTo Err_fConcatChild
End Select

Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

'Are we sure that 'sub' records exist
With rs
If .RecordCount <> 0 Then
'start concatenating records
Do While Not rs.EOF
varConcat = varConcat & rs(strFldConcat) & vbCrLf
.MoveNext
Loop
End If
End With

'That's it... you should have a concatenated string now
'Just Trim the trailing ;
fConcatChild = Left(varConcat, Len(varConcat) - 2)

Exit_fConcatChild:
Set rs = Nothing: Set db = Nothing
Exit Function
Err_fConcatChild:
Resume Exit_fConcatChild
End Function
***************************

Apart from trying to get this module to do as I wish it, I had though of
using a maketable query to put the entries I wish to use into a temporary
table, then running this function on that data, but it would be nice to know
how to modify the module with a restriction.

TIA
Dixie
PS sorry about the length of this post.

I don't see where you are restricting by a date range. And the code
doesn't have any place for restricting it.

Dev's code puts in the name of the column to return from a table where
the ID = a key value passed.

If you know what the date range is, you could pass another argument to
the function. For example

'sample code prior to calling the function
Dim strTable As String
Dim strColumnToConcat As String
Dim strFieldNameOfKey As String
Dim strKeyValue As Variant
Dim strKeyType As String
Dim strDateRestrict As String

strTable = "Order Details"
strColumn = "Quantity"
strFieldNameOfKey = "OrderID"
strKeyValue = 10255
strKeyType = "Long"

***********
'Scenario 1: You have a from/To date on a form
'now we'll assume you have a FromDate and a ToDate on the form
'let's assume in the table the date field is called DateFld
'remember, date fields are surrounded by #
If Not IsNull(Me.FromDate) Then
strDateRestrict = "DateFld >= #" & Me.FromDate & "#"
Endif
If Not IsNull(Me.FromDate) And Not IsNull(Me.ToDate) Then
strDateRestrict = strDateRestrict & " And "
Endif
If Not IsNull(Me.FromDate) Then
strDateRestrict = strDateRestrict & _
"DateFld <= #" & Me.ToDate & "#"
Endif
********

***********
'Scenario 2: You have a From/To date variable
'if you didn't have a from/to date, this is how it would work
'with a variable. Again, the field in the table is assumed to
'be called DateFld
Dim datFrom As Date
Dim datTo As Date

'since the date fields have been dimmed, they are initialized
'to 12/30/1899 so check for that, not null
If Year(datFrom) <> 1899 Then
strDateRestrict = "DateFld >= #" & datFrom & "#"
Endif
If Year(datFrom) <> 1899 And Year(datFromDate) <> 1899 Then
strDateRestrict = strDateRestrict & " And "
Endif
If Year(datTo) <> 1899 Then
strDateRestrict = "DateFld <= #" & datTo & "#"
Endif
********

strTable = "Order Details"
strColumnToConcat = "Quantity"
strFieldNameOfKey = "OrderID"
strKeyValue = 10255
strKeyType = "Long"

fConcatChild(strTable, strFieldNameOfKeystrColumnToConcat, _
strKeyType, strKeyValue, strEDEatRestrict)
Now, the function needs to have the new argument and I'll call it
strDateFilter. Add it to the function.
Function fConcatChild(strChildTable As String, _
strIDName As String, _
strFldConcat As String, _
strIDType As String, _
varIDvalue As Variant,
strDateFilter As String) As String

Now you need to check for the date filter prior to opening the
recordset. If you passed something it it, add it to the SQL statement.
Change your above code to contain the following

If strDateFilter <> "" Tnen
strSQL = strSQL & " And " & strDateFilter
End If

Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
Nov 13 '05 #3
Thank you Piet, with a little bit of work on the string in the query, this
is now working fine. Nothing to it? Maybe for you, but at least I can
follow how it works and was able to modify the query string to suit, so I
consider I learned something. Thanks for helping.

dixie
Nov 13 '05 #4
Scenario 1: was my scenario - the start and end date both on the form. Both
have default dates that would encompass the whole range of entries.
I have read through your post and I think I follow it. I'll put some time
into it over the weekend and finish it off. I have already looked briefly
at a similar method from Piet Linden and at this stage, it seems to work OK.
I will particulary look at your code to check that the restrictor has valid
data. I think I need to check for the case where the end date is earlier
than the start date.

Thanks for your help Salad. It is always good to know that such
knowledgeable people are willing to help people.

dixie
Nov 13 '05 #5
Pieter, just ran into a surprising problem that took me half an hour to work
out. I am in Australia. Our date format is DD/MM/YYYY. When I run this
function, it is using American Date format. So it takes the date from my
text boxes and reverses the day and the month (where this is possible). Is
there any way around this?

dixie

<pi********@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
You have to pass the StartDate and EndDate into the function, so it
should look like this:

Function fConcatChild(strChildTable As String, _
strIDName As String, _
strFldConcat As String, _
strIDType As String, _
varIDvalue As Variant _
dtmStart As Date, _
dtmEnd As Date, _
As String
'--Function body (mostly omitted for brevity!)
End Function

then after this:

Select Case strIDType
Case "String":
strSQL = strSQL & "[" & strIDName & "] = '" & varIDvalue &
"'"
Case "Long", "Integer", "Double": 'AutoNumber is Type Long
strSQL = strSQL & "[" & strIDName & "] = " & varIDvalue
Case Else
GoTo Err_fConcatChild
End Select

You need to drop in the date filtering part of the WHERE clause
strSQL = strSQL & " AND [SomeDate] BETWEEN #" & dtmStart & "# AND #" &
dtmEnd &"#"

see? nothing to it, right?

Nov 13 '05 #6
Here... found one from Allen Browne... so it'll work.

4. Allen Browne Oct 12 2000, 11:36 pm show options
Newsgroups: comp.databases.ms-access
From: Allen Browne <abro...@odyssey.apana.org.au> - Find messages by
this author
Date: Fri, 13 Oct 2000 12:38:17 +0800
Local: Thurs, Oct 12 2000 11:38 pm
Subject: Re: Date Format

Michael, my experience suggests that Format() with "#" handles
the case where Access misunderstands the data type, but CDate()
does not:

Function TestDate()
Dim strWhere As String
Dim varResult As Variant

strWhere = "DOB = #" & Format("1/2/00", "mm\/dd\/yyyy") & "#"
varResult = DLookup("DOB", "tblCustomer", strWhere)
Debug.Print varResult, strWhere

strWhere = "DOB = " & CDate("1/2/00")
varResult = DLookup("DOB", "tblCustomer", strWhere)
Debug.Print varResult, strWhere

strWhere = "DOB = #" & CDate("1/2/00") & "#"
varResult = DLookup("DOB", "tblCustomer", strWhere)
Debug.Print varResult, strWhere
End Function

Output (with Short Date defined as dd/mm/yyyy in Control Panel):
1/02/2000 DOB = #02/01/2000#
Null DOB = 1/02/2000
Null DOB = #1/02/2000#

Nov 13 '05 #7
Well Pieter, I tried all 3 of those and still get the same results. On
31/8/2005, I get the expected result. When I roll the date up to 1/9/2005,
I get no result. I found that if I modify the Dev Ashish module to use any
of these methods, I get no result at all. If I use the original code you
gave me, I get a result for days later than the 12th of each month where you
cant roll the date around. I also tried to use the CDate and Format in the
query as well. I got the same result no matter what I used. In contol
panel, my short date is set to dd/mm/yyyy.

These are the 3 possibilities I have tried in the module

strSQL = strSQL & " AND [Date] BETWEEN #" & dtmStart & "# AND #" & dtmEnd &
"#"
'strSQL = strSQL & " AND [Date] BETWEEN #" & Format(dtmStart, "mm/dd/yyyy")
& "# AND #" & Format(dtmStart, "mm/dd/yyyy") & "#"
'strSQL = strSQL & " AND [Date] BETWEEN #" & CDate(dtmStart) & "# AND #" &
CDate(dtmStart) & "#"

The first, which is not commented out here, is the one you gave me
initially. The other 2 are my interpretation of Allen Browne's code.

dixie

<pi********@hotmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Here... found one from Allen Browne... so it'll work.

4. Allen Browne Oct 12 2000, 11:36 pm show options
Newsgroups: comp.databases.ms-access
From: Allen Browne <abro...@odyssey.apana.org.au> - Find messages by
this author
Date: Fri, 13 Oct 2000 12:38:17 +0800
Local: Thurs, Oct 12 2000 11:38 pm
Subject: Re: Date Format

Michael, my experience suggests that Format() with "#" handles
the case where Access misunderstands the data type, but CDate()
does not:

Function TestDate()
Dim strWhere As String
Dim varResult As Variant

strWhere = "DOB = #" & Format("1/2/00", "mm\/dd\/yyyy") & "#"
varResult = DLookup("DOB", "tblCustomer", strWhere)
Debug.Print varResult, strWhere

strWhere = "DOB = " & CDate("1/2/00")
varResult = DLookup("DOB", "tblCustomer", strWhere)
Debug.Print varResult, strWhere

strWhere = "DOB = #" & CDate("1/2/00") & "#"
varResult = DLookup("DOB", "tblCustomer", strWhere)
Debug.Print varResult, strWhere
End Function

Output (with Short Date defined as dd/mm/yyyy in Control Panel):
1/02/2000 DOB = #02/01/2000#
Null DOB = 1/02/2000
Null DOB = #1/02/2000#

Nov 13 '05 #8
"Dixie" <di***@dogmail.com> wrote in
news:43********@duster.adelaide.on.net:
I have a problem using Dev Ashish's excellent module to
concatenate the results of a field from several records into
one record.

I am using the code to concatenate certain awards onto a
certificate at the end of the year. I have the code working
fine, except for the fact that when I want to restrict the
entries to awards between certain dates, even though I can use
the restriction in the query that shows the actual records,
when the fConcatChild function runs, it picks up all the
entries, regardless of the date restriction. I tried to run
the table part as a qry rather than a tbl, but no joy. I
think the code inside Dev's module will need to get have the
date restriction in it. I need the type of restriction that
is WHERE Date >start date <End date.

Does anyone know how to do that within the module.
The code in that module is beyond my expertise.

Dev's code works perfectly well against a query name passed as
the strChildTable parameter, so your problem is for some reason
other than the code,

I see from other replies that you encountered other issues with
the date format issues.

Did you check that the query has all the fields from your main
table and just a filter for the date range. Test it to make sure
that that's not where the problem lies.

example:.
SELECT * from tblSomeTable WHERE dMyDate BETWEEN dLoDate AND
dHiDate.

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #9
My brain must be fading. After staring at this code for ages, I spotted the
mistake I had made in it. The final version has:

strSQL = strSQL & " AND [Date] BETWEEN #" & Format(dtmStart, "mm\/dd\/yyyy")
& "# AND #" & Format(dtmEnd, "mm\/dd\/yyyy") & "#"

I also visited Allen Browne's website and read his help article on date
formatting. Very informative.

It works just as it should have now. Thankyou very much Pieter for taking
the time to dig that piece of code out for me.

dixie
<pi********@hotmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Here... found one from Allen Browne... so it'll work.

4. Allen Browne Oct 12 2000, 11:36 pm show options
Newsgroups: comp.databases.ms-access
From: Allen Browne <abro...@odyssey.apana.org.au> - Find messages by
this author
Date: Fri, 13 Oct 2000 12:38:17 +0800
Local: Thurs, Oct 12 2000 11:38 pm
Subject: Re: Date Format

Michael, my experience suggests that Format() with "#" handles
the case where Access misunderstands the data type, but CDate()
does not:

Function TestDate()
Dim strWhere As String
Dim varResult As Variant

strWhere = "DOB = #" & Format("1/2/00", "mm\/dd\/yyyy") & "#"
varResult = DLookup("DOB", "tblCustomer", strWhere)
Debug.Print varResult, strWhere

strWhere = "DOB = " & CDate("1/2/00")
varResult = DLookup("DOB", "tblCustomer", strWhere)
Debug.Print varResult, strWhere

strWhere = "DOB = #" & CDate("1/2/00") & "#"
varResult = DLookup("DOB", "tblCustomer", strWhere)
Debug.Print varResult, strWhere
End Function

Output (with Short Date defined as dd/mm/yyyy in Control Panel):
1/02/2000 DOB = #02/01/2000#
Null DOB = 1/02/2000
Null DOB = #1/02/2000#

Nov 13 '05 #10
Help, this is never ending. I just thought of another one that I can't do
outside the module and that is to have the facility to not include certain
awards on a certificate. I have a Y/N field called 'Certificate'. I would
like to restrict the number of awards concatenated to only those whose
'Certificate' field is 0 (zero). I presume this would need a 2nd part to
the WHERE clause which is currently:

strSQL = strSQL & " AND [Date] BETWEEN #" & Format(dtmStart, "mm\/dd\/yyyy")
& "# AND #" & Format(dtmEnd, "mm\/dd\/yyyy") & "#"

I imagine another AND clause? and another argument as well. What I have
working now is as follows:

'**************************************
Function fConcatChild(strChildTable As String, _
strIDName As String, _
strFldConcat As String, _
strIDType As String, _
varIDvalue As Variant, _
dtmStart As Date, _
dtmEnd As Date) _
As String

'Returns a field from the Many table of a 1:M relationship
'in a semi-colon separated format.
'
'Usage Examples:
' ?fConcatChild("Order Details", "OrderID", "Quantity", _
"Long", 10255)
'Where Order Details = Many side table
' OrderID = Primary Key of One side table
' Quantity = Field name to concatenate
' Long = DataType of Primary Key of One Side Table
' 10255 = Value on which return concatenated Quantity

Dim db As Database
Dim rs As Recordset
Dim varConcat As Variant
Dim strCriteria As String, strSQL As String
On Error GoTo Err_fConcatChild

varConcat = Null
Set db = CurrentDb
strSQL = "Select [" & strFldConcat & "] From [" & strChildTable & "]"
strSQL = strSQL & " Where "

Select Case strIDType
Case "String":
strSQL = strSQL & "[" & strIDName & "] = '" & varIDvalue & "'"
Case "Long", "Integer", "Double": 'AutoNumber is Type Long
strSQL = strSQL & "[" & strIDName & "] = " & varIDvalue
Case Else
GoTo Err_fConcatChild
End Select

strSQL = strSQL & " AND [Date] BETWEEN #" & Format(dtmStart, "mm\/dd\/yyyy")
& "# AND #" & Format(dtmEnd, "mm\/dd\/yyyy") & "#"

Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

'Are we sure that 'sub' records exist
With rs
If .RecordCount <> 0 Then
'start concatenating records
Do While Not rs.EOF
varConcat = varConcat & rs(strFldConcat) & vbCrLf
.MoveNext
Loop
End If
End With
'******************************

If I can get this part, that should round it off nicely, as I can't think of
any other delimiter I would need.

Hope you can help. I know this is probably just straight SQL, but I failed
that part. :-(
Nov 13 '05 #11
You know the best way to solve your problems? Put a message for help on the
newsgroup, then 5 minutes later, you're bound to solve it yourself anyway.
:-).
Seems I was on the right track - I added another argument booCert AS Boolean
and added the following line after my current WHERE clause.
strSQL = strSQL & " AND [Certificate] = 0"

That appears to work. I will need to test it more, but at this stage, it
seems to be fine. It might not be elegant, but what the heck.

Thanks guys, learning heaps.

dixie

"Dixie" <di***@dogmail.com> wrote in message
news:43******@duster.adelaide.on.net...
Help, this is never ending. I just thought of another one that I can't do
outside the module and that is to have the facility to not include certain
awards on a certificate. I have a Y/N field called 'Certificate'. I
would like to restrict the number of awards concatenated to only those
whose 'Certificate' field is 0 (zero). I presume this would need a 2nd
part to the WHERE clause which is currently:

strSQL = strSQL & " AND [Date] BETWEEN #" & Format(dtmStart,
"mm\/dd\/yyyy") & "# AND #" & Format(dtmEnd, "mm\/dd\/yyyy") & "#"

I imagine another AND clause? and another argument as well. What I have
working now is as follows:

'**************************************
Function fConcatChild(strChildTable As String, _
strIDName As String, _
strFldConcat As String, _
strIDType As String, _
varIDvalue As Variant, _
dtmStart As Date, _
dtmEnd As Date) _
As String

'Returns a field from the Many table of a 1:M relationship
'in a semi-colon separated format.
'
'Usage Examples:
' ?fConcatChild("Order Details", "OrderID", "Quantity", _
"Long", 10255)
'Where Order Details = Many side table
' OrderID = Primary Key of One side table
' Quantity = Field name to concatenate
' Long = DataType of Primary Key of One Side Table
' 10255 = Value on which return concatenated Quantity

Dim db As Database
Dim rs As Recordset
Dim varConcat As Variant
Dim strCriteria As String, strSQL As String
On Error GoTo Err_fConcatChild

varConcat = Null
Set db = CurrentDb
strSQL = "Select [" & strFldConcat & "] From [" & strChildTable & "]"
strSQL = strSQL & " Where "

Select Case strIDType
Case "String":
strSQL = strSQL & "[" & strIDName & "] = '" & varIDvalue & "'"
Case "Long", "Integer", "Double": 'AutoNumber is Type Long
strSQL = strSQL & "[" & strIDName & "] = " & varIDvalue
Case Else
GoTo Err_fConcatChild
End Select

strSQL = strSQL & " AND [Date] BETWEEN #" & Format(dtmStart,
"mm\/dd\/yyyy") & "# AND #" & Format(dtmEnd, "mm\/dd\/yyyy") & "#"

Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

'Are we sure that 'sub' records exist
With rs
If .RecordCount <> 0 Then
'start concatenating records
Do While Not rs.EOF
varConcat = varConcat & rs(strFldConcat) & vbCrLf
.MoveNext
Loop
End If
End With
'******************************

If I can get this part, that should round it off nicely, as I can't think
of any other delimiter I would need.

Hope you can help. I know this is probably just straight SQL, but I
failed that part. :-(

Nov 13 '05 #12
Dixie wrote:
You know the best way to solve your problems? Put a message for help on the
newsgroup, then 5 minutes later, you're bound to solve it yourself anyway.
:-).


Yup, that happens to me a lot too! 8)

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #13
Just found one more thing I want to filter for in this concatenate module.
It is a field called [Year] which is a format 'General number', field size
'byte'. Can someone tell me what to put in the argument (I think that is
what you call it :-) The following part.

Function fConcatChild(strChildTable As String, _
strIDName As String, _
strFldConcat As String, _
strIDType As String, _
varIDvalue As Variant, _
dtmStart As Date, _
dtmEnd As Date) _
As String

the bit, I need to know is what to put for the As part. For example, if I
called it Year As xxx, what would the xxx have to be?

The rest, I'll have a go at myself.

dixie

"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:df**********@coranto.ucs.mun.ca...
Dixie wrote:
You know the best way to solve your problems? Put a message for help on
the newsgroup, then 5 minutes later, you're bound to solve it yourself
anyway. :-).


Yup, that happens to me a lot too! 8)

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto

Nov 13 '05 #14
Don't worry about this one. Didn't need to do this anyway. Next time, I
will think a bit longer before I go for the newsgroup. :-)

dixie

"Dixie" <di***@dogmail.com> wrote in message
news:43********@duster.adelaide.on.net...
Just found one more thing I want to filter for in this concatenate module.
It is a field called [Year] which is a format 'General number', field size
'byte'. Can someone tell me what to put in the argument (I think that is
what you call it :-) The following part.

Function fConcatChild(strChildTable As String, _
strIDName As String, _
strFldConcat As String, _
strIDType As String, _
varIDvalue As Variant, _
dtmStart As Date, _
dtmEnd As Date) _
As String

the bit, I need to know is what to put for the As part. For example, if I
called it Year As xxx, what would the xxx have to be?

The rest, I'll have a go at myself.

dixie

"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:df**********@coranto.ucs.mun.ca...
Dixie wrote:
You know the best way to solve your problems? Put a message for help on
the newsgroup, then 5 minutes later, you're bound to solve it yourself
anyway. :-).


Yup, that happens to me a lot too! 8)

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto


Nov 13 '05 #15
Bob Quintal wrote:
"Dixie" <di***@dogmail.com> wrote in
news:43********@duster.adelaide.on.net:

I have a problem using Dev Ashish's excellent module to
concatenate the results of a field from several records into
one record.

I am using the code to concatenate certain awards onto a
certificate at the end of the year. I have the code working
fine, except for the fact that when I want to restrict the
entries to awards between certain dates, even though I can use
the restriction in the query that shows the actual records,
when the fConcatChild function runs, it picks up all the
entries, regardless of the date restriction. I tried to run
the table part as a qry rather than a tbl, but no joy. I
think the code inside Dev's module will need to get have the
date restriction in it. I need the type of restriction that
is WHERE Date >start date <End date.

Does anyone know how to do that within the module.
The code in that module is beyond my expertise.


Dev's code works perfectly well against a query name passed as
the strChildTable parameter, so your problem is for some reason
other than the code,

I see from other replies that you encountered other issues with
the date format issues.

Did you check that the query has all the fields from your main
table and just a filter for the date range. Test it to make sure
that that's not where the problem lies.

example:.
SELECT * from tblSomeTable WHERE dMyDate BETWEEN dLoDate AND
dHiDate.


Hi Bob. She had a second parameter, date range. Dev's code only took
into consideration 1 criteria for the filter.
Nov 13 '05 #16
Salad <oi*@vinegar.com> wrote in
news:9W***************@newsread3.news.pas.earthlin k.net:
Bob Quintal wrote:
"Dixie" <di***@dogmail.com> wrote in
news:43********@duster.adelaide.on.net:

I have a problem using Dev Ashish's excellent module to
concatenate the results of a field from several records into
one record.

I am using the code to concatenate certain awards onto a
certificate at the end of the year. I have the code working
fine, except for the fact that when I want to restrict the
entries to awards between certain dates, even though I can
use the restriction in the query that shows the actual
records, when the fConcatChild function runs, it picks up all
the entries, regardless of the date restriction. I tried to
run the table part as a qry rather than a tbl, but no joy. I
think the code inside Dev's module will need to get have the
date restriction in it. I need the type of restriction that
is WHERE Date >start date <End date.

Does anyone know how to do that within the module.
The code in that module is beyond my expertise.


Dev's code works perfectly well against a query name passed
as the strChildTable parameter, so your problem is for some
reason other than the code,

I see from other replies that you encountered other issues
with the date format issues.

Did you check that the query has all the fields from your
main table and just a filter for the date range. Test it to
make sure that that's not where the problem lies.

example:.
SELECT * from tblSomeTable WHERE dMyDate BETWEEN dLoDate AND
dHiDate.


Hi Bob. She had a second parameter, date range. Dev's code
only took into consideration 1 criteria for the filter.


Sorry for the belated reply, I was using teranews, which started
dropping posts, and has been unreachable for a week now.

Anyways, I addressed the question of the date range, but perhaps
I could have done so more clearly.

Dixie claimed, and I quote
the entries, regardless of the date restriction. I tried to
run the table part as a qry rather than a tbl, but no joy. I

to which I answered
Dev's code works perfectly well against a query name passed
as the strChildTable parameter, so your problem is for some
reason other than the code,

That query would have filtered against the date range, returning
the pk and values to be concatenated. ,

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Richard Hollenbeck | last post by:
To prevent future apostrophe bugs and errors, isn't it just simpler to forbid an apostrophe from being entered into a text field? For example, couldn't "Alice's Restaurant" be changed to "Alices...
4
by: ghadley_00 | last post by:
I have an access database form where I have a button that is supposed to be appending the contents of 1 memo field to another is behaving non-predictably. The code is: Me! = Me! & Chr$(13) &...
4
by: Juan | last post by:
Does any one know if there are reported bugs when concatenating strings? When debugging each variable has the correct value but when I try to concatenate them some values are missing (I canīt see...
4
by: Elena | last post by:
Hi, I am filling in a combobox. I would like to concatenate two fields into the data combo box and display "last name, first name" I tried to displaymember = "employee_last_name" & ", " &...
7
by: Mary | last post by:
I have a student who has a hyphenated first name. If I concatenate the name like this: StudentName:( & ", " & ), it works as expected. If, however, I try to get the first name first by...
5
by: JRNewKid | last post by:
I want to concatenate two fields on a report. They are two text fields, wrkDescription is 10 characters long and wrkTextDescription is 255. I have them concatenated in the report but I'm only...
1
by: peck2000 | last post by:
Related to my earleir post ... this is the same project to re-purpose the Classifieds application in BEGINNING ASP 3.0 (Wrox) to a comicbook database ... This is a brainteaser that should have...
4
by: exrcizn | last post by:
I am creating a query in Access 2003 that basically displays data in certain fields in a table (plain and simple basic stuff). I have a field in the table that may or may not contain data. If the...
2
by: Whizzo | last post by:
Hi all; I'm using this great bit of code to concatenate a fields from multiple rows into a single one. 'Concat Returns lists of items which are within a grouped field Public Function...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.