Blank report

G

Guest

Hi,
My report looks like this


Name ---------------------------- ( name label and name are in name header)


ID--------------------------------- ( ID label and ID are in ID header)


Activity--------------------------- (In activity header)


Detail------------------------------ ( In detail section)


This report is of several pages. For at least 200 names. Names can be same
but they have different id.
Now what I want is I want to call report belonging to only certain name and
ID. I select that name and ID in a combo box in form and press the command
button “preview report†The command button has following code


stDocName = " Activities Report2"
DoCmd.OpenReport stDocName, acPreview, , "[Name]= '" & Me!Name & " '"

This gives me blank report.
Same code works if the name is in detail section and name label is in page
header

Looks to me that the above code can not select the name when it is in name
header.

Please help!
 
A

Al Campagna

senkurion,
Try using the Where argument in the OpenReport method.
Never name a field "Name". It's a reserved word in Access.
You also have a space preceding your report name (" Activities Report2")
You're also using some "name" field to identify a person... you should be using the Key
field value instead of a name... to prevent ambiguity. Something like an EmpID, or
StudentID, or CustID.

I'd suggest using acPreview while you test, then remove it when the report opens
properly.

DoCmd.OpenReport "Activities Report2", acPreview,, "[CustomerID] = '" & CustID & "'"

"should" do it.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
G

Guest

Does not work either, the extra space was just a typo. The code I mentioned
works when the field "name" is in detail section instead of name head. any
idea??

Al Campagna said:
senkurion,
Try using the Where argument in the OpenReport method.
Never name a field "Name". It's a reserved word in Access.
You also have a space preceding your report name (" Activities Report2")
You're also using some "name" field to identify a person... you should be using the Key
field value instead of a name... to prevent ambiguity. Something like an EmpID, or
StudentID, or CustID.

I'd suggest using acPreview while you test, then remove it when the report opens
properly.

DoCmd.OpenReport "Activities Report2", acPreview,, "[CustomerID] = '" & CustID & "'"

"should" do it.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

senkurion said:
Hi,
My report looks like this


Name ---------------------------- ( name label and name are in name header)


ID--------------------------------- ( ID label and ID are in ID header)


Activity--------------------------- (In activity header)


Detail------------------------------ ( In detail section)


This report is of several pages. For at least 200 names. Names can be same
but they have different id.
Now what I want is I want to call report belonging to only certain name and
ID. I select that name and ID in a combo box in form and press the command
button "preview report" The command button has following code


stDocName = " Activities Report2"
DoCmd.OpenReport stDocName, acPreview, , "[Name]= '" & Me!Name & " '"

This gives me blank report.
Same code works if the name is in detail section and name label is in page
header

Looks to me that the above code can not select the name when it is in name
header.

Please help!
 
G

Guest

How about placing brackets around your reportname like:

[Activities Report2]

Maurice

senkurion said:
Does not work either, the extra space was just a typo. The code I mentioned
works when the field "name" is in detail section instead of name head. any
idea??

Al Campagna said:
senkurion,
Try using the Where argument in the OpenReport method.
Never name a field "Name". It's a reserved word in Access.
You also have a space preceding your report name (" Activities Report2")
You're also using some "name" field to identify a person... you should be using the Key
field value instead of a name... to prevent ambiguity. Something like an EmpID, or
StudentID, or CustID.

I'd suggest using acPreview while you test, then remove it when the report opens
properly.

DoCmd.OpenReport "Activities Report2", acPreview,, "[CustomerID] = '" & CustID & "'"

"should" do it.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

senkurion said:
Hi,
My report looks like this


Name ---------------------------- ( name label and name are in name header)


ID--------------------------------- ( ID label and ID are in ID header)


Activity--------------------------- (In activity header)


Detail------------------------------ ( In detail section)


This report is of several pages. For at least 200 names. Names can be same
but they have different id.
Now what I want is I want to call report belonging to only certain name and
ID. I select that name and ID in a combo box in form and press the command
button "preview report" The command button has following code


stDocName = " Activities Report2"
DoCmd.OpenReport stDocName, acPreview, , "[Name]= '" & Me!Name & " '"

This gives me blank report.
Same code works if the name is in detail section and name label is in page
header

Looks to me that the above code can not select the name when it is in name
header.

Please help!
 
A

Al Campagna

senkurion,
You wrote...
Does not work either, the extra space was just a typo.
That's why it's always best to copy and paste your code into your post, rather than
retype it manually.

I asked you to drop the name "Name", have you done that?

Describe the combo setup on the form in detail (Columns, and sample values), and be
sure that what you're "showing" in the combo is really what is stored in that combo.
Also, show some sample data from your report... as it appears now.
You seem to say that the form combo has a name and an ID. You should be using the ID
to filter the report... not the name.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


senkurion said:
Does not work either, the extra space was just a typo. The code I mentioned
works when the field "name" is in detail section instead of name head. any
idea??

Al Campagna said:
senkurion,
Try using the Where argument in the OpenReport method.
Never name a field "Name". It's a reserved word in Access.
You also have a space preceding your report name (" Activities Report2")
You're also using some "name" field to identify a person... you should be using the
Key
field value instead of a name... to prevent ambiguity. Something like an EmpID, or
StudentID, or CustID.

I'd suggest using acPreview while you test, then remove it when the report opens
properly.

DoCmd.OpenReport "Activities Report2", acPreview,, "[CustomerID] = '" & CustID &
"'"

"should" do it.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

senkurion said:
Hi,
My report looks like this


Name ---------------------------- ( name label and name are in name header)


ID--------------------------------- ( ID label and ID are in ID header)


Activity--------------------------- (In activity header)


Detail------------------------------ ( In detail section)


This report is of several pages. For at least 200 names. Names can be same
but they have different id.
Now what I want is I want to call report belonging to only certain name and
ID. I select that name and ID in a combo box in form and press the command
button "preview report" The command button has following code


stDocName = " Activities Report2"
DoCmd.OpenReport stDocName, acPreview, , "[Name]= '" & Me!Name & " '"

This gives me blank report.
Same code works if the name is in detail section and name label is in page
header

Looks to me that the above code can not select the name when it is in name
header.

Please help!
 
A

Al Campagna

Added note.....
Please include the following about your combobox...
Name, No of Columns, Column Widths, example of what each column contains for values.
Is it bound (is so what is it bound to) or unbound.

As a side note, since ID and SomeName are related one to one, there's really no need
for the ID header on your report. Given just an ID header, you could display
ID Header -----------------------
SomeName SomeID
Activity ------------------------
Detail ----------------------------
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


senkurion said:
Does not work either, the extra space was just a typo. The code I mentioned
works when the field "name" is in detail section instead of name head. any
idea??

Al Campagna said:
senkurion,
Try using the Where argument in the OpenReport method.
Never name a field "Name". It's a reserved word in Access.
You also have a space preceding your report name (" Activities Report2")
You're also using some "name" field to identify a person... you should be using the
Key
field value instead of a name... to prevent ambiguity. Something like an EmpID, or
StudentID, or CustID.

I'd suggest using acPreview while you test, then remove it when the report opens
properly.

DoCmd.OpenReport "Activities Report2", acPreview,, "[CustomerID] = '" & CustID &
"'"

"should" do it.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

senkurion said:
Hi,
My report looks like this


Name ---------------------------- ( name label and name are in name header)


ID--------------------------------- ( ID label and ID are in ID header)


Activity--------------------------- (In activity header)


Detail------------------------------ ( In detail section)


This report is of several pages. For at least 200 names. Names can be same
but they have different id.
Now what I want is I want to call report belonging to only certain name and
ID. I select that name and ID in a combo box in form and press the command
button "preview report" The command button has following code


stDocName = " Activities Report2"
DoCmd.OpenReport stDocName, acPreview, , "[Name]= '" & Me!Name & " '"

This gives me blank report.
Same code works if the name is in detail section and name label is in page
header

Looks to me that the above code can not select the name when it is in name
header.

Please help!
 
G

Guest

Hi, my report looks like this

My table looks like this

ID Name Activity Date Instructor Cost 1 Cost 2 Notes


It has records of about 200 ppl
Then there is a query based upon this table which looks almost similar to
the table

Then there is report.This looks like this

Activity Report this Report Header
Name (linked to the queries name field) this is name Header
ID (linked to the ID field of ) this is ID header
Activity (linked to activity field) this is activity header

Date label Instructor label cost 1 label cost 2 label notes label

Detail section
Date Instructor Cost1 Cost 2 Notes

Report footer
Sum

The report are grouped by three levels, Name, ID and activity

The combo box in form has a name field which takes the names from same query
as the report..
So when I select the name in combo box and press the button,†preview
report†it gives me a report but the report is without data.

I checked with a table with only one record then it gives the report with
data but as soon as I add more data it gives blank report..

Also If I don’t group any grouping levels it works

Code for the command button

stDocName = " Activities Report2"
DoCmd.OpenReport stDocName, acPreview, , "[Name]= '" & Me!Name & " '"

Please help
 
G

Guest

Label of combo boX- Name and ID
No of column -2
first column linked to name field
second column linked to ID
column width- 5 cm, 1 cm
bound column -2
control source-name



Al Campagna said:
Added note.....
Please include the following about your combobox...
Name, No of Columns, Column Widths, example of what each column contains for values.
Is it bound (is so what is it bound to) or unbound.

As a side note, since ID and SomeName are related one to one, there's really no need
for the ID header on your report. Given just an ID header, you could display
ID Header -----------------------
SomeName SomeID
Activity ------------------------
Detail ----------------------------
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


senkurion said:
Does not work either, the extra space was just a typo. The code I mentioned
works when the field "name" is in detail section instead of name head. any
idea??

Al Campagna said:
senkurion,
Try using the Where argument in the OpenReport method.
Never name a field "Name". It's a reserved word in Access.
You also have a space preceding your report name (" Activities Report2")
You're also using some "name" field to identify a person... you should be using the
Key
field value instead of a name... to prevent ambiguity. Something like an EmpID, or
StudentID, or CustID.

I'd suggest using acPreview while you test, then remove it when the report opens
properly.

DoCmd.OpenReport "Activities Report2", acPreview,, "[CustomerID] = '" & CustID &
"'"

"should" do it.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."




Hi,
My report looks like this


Name ---------------------------- ( name label and name are in name header)


ID--------------------------------- ( ID label and ID are in ID header)


Activity--------------------------- (In activity header)


Detail------------------------------ ( In detail section)


This report is of several pages. For at least 200 names. Names can be same
but they have different id.
Now what I want is I want to call report belonging to only certain name and
ID. I select that name and ID in a combo box in form and press the command
button "preview report" The command button has following code


stDocName = " Activities Report2"
DoCmd.OpenReport stDocName, acPreview, , "[Name]= '" & Me!Name & " '"

This gives me blank report.
Same code works if the name is in detail section and name label is in page
header

Looks to me that the above code can not select the name when it is in name
header.

Please help!
 
A

Al Campagna

1. First, you need to get rid of that fieldname "Name"
Go back to your table, and rename it to something else (more meaningful) like EmpName,
CustName, etc... (I'll use EmpName in my response)

2. Second, set up your combobox on the form to provide a key field "unique" value for the
report to use as a filter. Do not use EmpName..., it's not unique enough, and will cause
problems if and when the Employee table grows.
I would suggest 2 columns...
Example only....
EmpID EmpName
143 Smith, Bob
511 Jones, Mary
104 Allen, Rick
Change the name of your combobox on the form to something other than "Name"... ex.
cboEmpID.

3. Add an unbound text control on the form with a Control Source of
= cboEmpID
We'll use that to test our cboEmpID slected value

Let's just try to get that far, then we can take it from there.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 

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