view Report with all accounts

G

George

Hi there,
I have a report that when run prompts me enter the name of the account (this
is default of query), so only the one account appears in the report. Is there
somewhere in the report design i can over ride this so i can view all
accounts in the one report? e.g can i enter all the account names in a field
so they all appear on the report? Or can this be done from a Form?
Many thanks
George
 
D

Duane Hookom

You can add a combo box for accounts on a form. Then add a command button to
open your report. Change the code to use a WHERE clause like:

Dim strWhere as String
strWhere = "1 = 1 "
If Not IsNull(Me.cboAccount) Then
'assuming Account is text
strWhere = strWhere & " And [Account] = """ & Me.cboAccount & """ "
End If
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere
 
G

George

Hi Duane,
Thanks for your assistance, however i am new to vb code and just pasting in
to the command button doesn't get me there. An error appears in the row :If
Not IsNull(Me.cboAccount). I dont know how to repair as i dont know what a
Me.cbo is. Can you provide any more help here?
Thanks
George

Duane Hookom said:
You can add a combo box for accounts on a form. Then add a command button to
open your report. Change the code to use a WHERE clause like:

Dim strWhere as String
strWhere = "1 = 1 "
If Not IsNull(Me.cboAccount) Then
'assuming Account is text
strWhere = strWhere & " And [Account] = """ & Me.cboAccount & """ "
End If
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere


--
Duane Hookom
MS Access MVP

George said:
Hi there,
I have a report that when run prompts me enter the name of the account
(this
is default of query), so only the one account appears in the report. Is
there
somewhere in the report design i can over ride this so i can view all
accounts in the one report? e.g can i enter all the account names in a
field
so they all appear on the report? Or can this be done from a Form?
Many thanks
George
 
D

Duane Hookom

cboAccount is the name provided for your combo box. If your combo box has a
different name, either change its name or change the code.

--
Duane Hookom
MS Access MVP

George said:
Hi Duane,
Thanks for your assistance, however i am new to vb code and just pasting
in
to the command button doesn't get me there. An error appears in the row
:If
Not IsNull(Me.cboAccount). I dont know how to repair as i dont know what a
Me.cbo is. Can you provide any more help here?
Thanks
George

Duane Hookom said:
You can add a combo box for accounts on a form. Then add a command button
to
open your report. Change the code to use a WHERE clause like:

Dim strWhere as String
strWhere = "1 = 1 "
If Not IsNull(Me.cboAccount) Then
'assuming Account is text
strWhere = strWhere & " And [Account] = """ & Me.cboAccount & """
"
End If
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere


--
Duane Hookom
MS Access MVP

George said:
Hi there,
I have a report that when run prompts me enter the name of the account
(this
is default of query), so only the one account appears in the report. Is
there
somewhere in the report design i can over ride this so i can view all
accounts in the one report? e.g can i enter all the account names in a
field
so they all appear on the report? Or can this be done from a Form?
Many thanks
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top