Trying to look like this

  • Thread starter Afrosheen via AccessMonster.com
  • Start date
A

Afrosheen via AccessMonster.com

Thanks for reading this. I'm trying to create a report that will print out
like example 1

Example 1
WorkPlan IntDue Final Due.
Tom January
Joe January
Mark January


The problem? It is showing up as:
WorkPlan IntDue Final Due.
Tom January March December
Joe April May January
Mark December January June

The code I use to create the print out is: Dim stDocName As String
strWhere = "qryTaps.WorkPlan=""" & strMon & _
""" or qryTaps.IntDue=""" & strMon & _
""" or qryTaps.FinalDue=""" & strMon & """"

All fields have information. I want to pick out the month. If the "Workplan,
IntDue, or FinalDue = the month selected then it will give me the print out
like example. The strMon is a variable.

Thanks for reading this. Your help is appreciated.
 
K

KARL DEWEY

How is the data stored? What is the table structure - field names and data
type?
Post sample data.
 
M

Marshall Barton

Afrosheen said:
Thanks for reading this. I'm trying to create a report that will print out
like example 1

Example 1
WorkPlan IntDue Final Due.
Tom January
Joe January
Mark January


The problem? It is showing up as:
WorkPlan IntDue Final Due.
Tom January March December
Joe April May January
Mark December January June

The code I use to create the print out is: Dim stDocName As String
strWhere = "qryTaps.WorkPlan=""" & strMon & _
""" or qryTaps.IntDue=""" & strMon & _
""" or qryTaps.FinalDue=""" & strMon & """"

All fields have information. I want to pick out the month. If the "Workplan,
IntDue, or FinalDue = the month selected then it will give me the print out
like example. The strMon is a variable.


I think you can use code in the detail section's Format
event:

Me.WorkPlan.Visible = (Me.WorkPlan = strMon)
Me.IntDue.Visible = (Me.IntDue = strMon)
Me.FinalDue.Visible = (Me.FinalDue = strMon)
 
A

Afrosheen via AccessMonster.com

Thanks Marshall, I'll try it out and let you know



Marshall said:
Thanks for reading this. I'm trying to create a report that will print out
like example 1
[quoted text clipped - 19 lines]
IntDue, or FinalDue = the month selected then it will give me the print out
like example. The strMon is a variable.

I think you can use code in the detail section's Format
event:

Me.WorkPlan.Visible = (Me.WorkPlan = strMon)
Me.IntDue.Visible = (Me.IntDue = strMon)
Me.FinalDue.Visible = (Me.FinalDue = strMon)
 
A

Afrosheen via AccessMonster.com

Sorry Marshall, It didn't work. It kept on asking me for parameters. When I
put them in all it said was
#name?

I did notice that when I put a msgbox strMon in, the strMon did not show up.


Thanks Marshall, I'll try it out and let you know
[quoted text clipped - 8 lines]
Me.IntDue.Visible = (Me.IntDue = strMon)
Me.FinalDue.Visible = (Me.FinalDue = strMon)
 
M

Marshall Barton

Afrosheen said:
Sorry Marshall, It didn't work. It kept on asking me for parameters. When I
put them in all it said was
#name?

I did notice that when I put a msgbox strMon in, the strMon did not show up.

Thanks Marshall, I'll try it out and let you know
Thanks for reading this. I'm trying to create a report that will print out
like example 1
[quoted text clipped - 8 lines]
Me.IntDue.Visible = (Me.IntDue = strMon)
Me.FinalDue.Visible = (Me.FinalDue = strMon)


You said that strMon is a variable, did you ever set it to
the desired month?

When you are getting unexpected prompts, it is very
important to note what you are prompted for because that's
the name you need to look at in the query or filter.
However, I can't see what you actually did and how that VBA
code in an event procedure could possibly have anything to
do with a query prompt???
 
A

Afrosheen via AccessMonster.com

Hi Marshall. Thanks for helping. I should have given you all the information.
I'm sorry for this. Here it is.

I have a form where I pick out the month, like January. The variable strMon
is the month and it's declared in a module as public. I set up a message box
to confirm that the strMon is January.
Once that is done then the VBA code is triggered:

strWhere = "qryTaps.WorkPlan=""" & strMon & _
""" or qryTaps.IntDue=""" & strMon & _
""" or qryTaps.FinalDue=""" & strMon & """"

Is executed and that works.

When I view the report it looks like this.

WorkPlan IntDue FinalDue
Tom January June July
George Febuary January November
Linda May April January

What I'm trying to get it to look like is this below.

WorkPlan IntDue FinalDue
Tom January
George January
Linda January

In the report I set up a text box with the code you gave me in the control
source. I ran the form and report and that where it was asking for the
parameters then after entering January for all, that's where it was showing
the #Name ?.

I tried expanding it and it didn't help.I thought it was too small.


Thanks again for your help. If you need any more information let me know.

Marshall said:
Sorry Marshall, It didn't work. It kept on asking me for parameters. When I
put them in all it said was
[quoted text clipped - 9 lines]
You said that strMon is a variable, did you ever set it to
the desired month?

When you are getting unexpected prompts, it is very
important to note what you are prompted for because that's
the name you need to look at in the query or filter.
However, I can't see what you actually did and how that VBA
code in an event procedure could possibly have anything to
do with a query prompt???
 
M

Marshall Barton

Afrosheen said:
Hi Marshall. Thanks for helping. I should have given you all the information.
I'm sorry for this. Here it is.

I have a form where I pick out the month, like January. The variable strMon
is the month and it's declared in a module as public. I set up a message box
to confirm that the strMon is January.
Once that is done then the VBA code is triggered:

strWhere = "qryTaps.WorkPlan=""" & strMon & _
""" or qryTaps.IntDue=""" & strMon & _
""" or qryTaps.FinalDue=""" & strMon & """"

Is executed and that works.

When I view the report it looks like this.

WorkPlan IntDue FinalDue
Tom January June July
George Febuary January November
Linda May April January

What I'm trying to get it to look like is this below.

WorkPlan IntDue FinalDue
Tom January
George January
Linda January

In the report I set up a text box with the code you gave me in the control
source. I ran the form and report and that where it was asking for the
parameters then after entering January for all, that's where it was showing
the #Name ?.


Ah ha! You put my VBA code in a text box's Control source
property. Since VBA variables are only known in VBA
procedures, you are being prompted by the report for the
variable.

You need to put my suggested VBA code in the report detail
section's Format event **procedure**. You can get to the
event procedure by clicking on a blank area or on the gray
bar at the top of the detail section. Then, if the property
sheet is not displayed, use the View - Properties to display
the property sheet. Look down the properties list and fine
the OnFormat property and click on the builder button [...]
over on the right of the property. That should open the VBA
Editor window and position the cursor between the
Sub Detail_Format(...
and
End Sub
line, ready for you to enter the code I suggested.

After, you enter the lines of code, use the VBA editor's
Debug - Compile menu item to compile you project and check
for compile errors. After it compiles without any error
messages, then run the report and see how it goes.
 
A

Afrosheen via AccessMonster.com

Marshall, You Are The Greatest.

Thanks again for your help. You've helped me out before on some coding and I
really appreciate it.

It works the way I want it to now.

Marshall said:
Hi Marshall. Thanks for helping. I should have given you all the information.
I'm sorry for this. Here it is.
[quoted text clipped - 28 lines]
parameters then after entering January for all, that's where it was showing
the #Name ?.

Ah ha! You put my VBA code in a text box's Control source
property. Since VBA variables are only known in VBA
procedures, you are being prompted by the report for the
variable.

You need to put my suggested VBA code in the report detail
section's Format event **procedure**. You can get to the
event procedure by clicking on a blank area or on the gray
bar at the top of the detail section. Then, if the property
sheet is not displayed, use the View - Properties to display
the property sheet. Look down the properties list and fine
the OnFormat property and click on the builder button [...]
over on the right of the property. That should open the VBA
Editor window and position the cursor between the
Sub Detail_Format(...
and
End Sub
line, ready for you to enter the code I suggested.

After, you enter the lines of code, use the VBA editor's
Debug - Compile menu item to compile you project and check
for compile errors. After it compiles without any error
messages, then run the report and see how it goes.
 

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