Concatanation of fields

tezread

Registered User.
Local time
Today, 22:55
Joined
Jan 26, 2010
Messages
330
I am using Allen Browns ConCat related function to put commas between values in a query with MeetingDate in one column and Apology in the other

I have

=ConcatRelated("Apology","QryApologys")

embedded in a text box of a report to show the names and this works but I am trying to limit it to the Meeting date using the value chosen in a form that opens that report.

I cannot put paramaters inthe query i.e. [Forms].[Form1].[Text0]
as these will not work in the context of the DAO code.

Is there a way someone can advise?

here is link to Allen Brown;

http://allenbrowne.com/func-concat.html
 
You are on a form and want to open a report with data on the form to be the Criteria??
If so, this should be straight forward.

You will see on Allen Browne's site a vba code to make this possible.

The code is used in the on clik event of a command button.

Your query as the record source for the report will show all records and the commend button code will limit the report to just the record that matches the data on the same form as the button.
 
You are on a form and want to open a report with data on the form to be the Criteria??
If so, this should be straight forward.

You will see on Allen Browne's site a vba code to make this possible.

The code is used in the on clik event of a command button.

Your query as the record source for the report will show all records and the commend button code will limit the report to just the record that matches the data on the same form as the button.

hiya

can't tell which one on allens site you mean?
 
sorry PNGBill - my VBA skills are limited - I can't see how this will limit my report to the Date chosen in my combo box.

struggling with this one
 
This code is in the command Button where you click to run the report.

In this example the link is by way of matching the ID in the Report to the Control in the form ID (Me.[ID])

In your case you would use the date to match.

Syntax may be slightly different for date.

Code:
Private Sub cmdPrint_Click()
    Dim strWhere As String

    If Me.Dirty Then    'Save any edits.
        Me.Dirty = False
    End If

    If Me.NewRecord Then 'Check there is a record to print
        MsgBox "Select a record to print"
    Else
        strWhere = "[[I]ID[/I]] = " & Me.[[I]ID[/I]]
        DoCmd.OpenReport "[I]MyReport[/I]", acViewPreview, , strWhere
    End If
End Sub

This is the important part

Code:
 strWhere = "[[I]ID[/I]] = " & Me.[[I]ID[/I]]
        DoCmd.OpenReport "[I]MyReport[/I]", acViewPreview, , strWhere

Report Name is MyReport and it is opened as Preview and the Link Criteria is strWhere
 

Users who are viewing this thread

Back
Top Bottom