A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Pesky Parameters



 
 
Thread Tools Display Modes
  #1  
Old December 19th, 2009, 02:11 AM posted to microsoft.public.access.reports
ryguy7272
external usenet poster
 
Posts: 1,593
Default Pesky Parameters

When I open a report I get prompted for two Parameters, FirstName and
LastName. I looked everywhere for these variables; not seeing anything at
all, but there must be something in there that’s causing this behavior. How
can I find out where those pesky parameters are?

Thanks!
Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
  #2  
Old December 19th, 2009, 03:49 AM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default Pesky Parameters

Look in:
- the Sorting And Grouping pane
- the Filter and Order By properties of the report
- the Control Source of controls (you probably looked there.)

If not found, examine the RecordSource of the report. If it's a query, try
running the query itself and see if it asks for parameters. Even if it's a
table, try opening that directly, as it could be in the table's Filter or
OrderBy properties, or the RowSource of one of its fields.

If you're still stuck, this might help you find it programmatically:
Where is a field used? - Search tables, queries, forms, reports
at:
http://allenbrowne.com/ser-73.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"ryguy7272" wrote in message
...
When I open a report I get prompted for two Parameters, FirstName and
LastName. I looked everywhere for these variables; not seeing anything at
all, but there must be something in there that’s causing this behavior.
How
can I find out where those pesky parameters are?

Thanks!
Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


  #3  
Old December 19th, 2009, 07:28 AM posted to microsoft.public.access.reports
ryguy7272
external usenet poster
 
Posts: 1,593
Default Pesky Parameters

That is some really slick code, Allen!! With your code, Access was telling
me that 'LastName' and 'FirstName' was 0. Well, I couldn’t find the problem
so I rebuilt the report, now I am also struggling a bit of code that
dynamically filters elements in a report. I have a form with the following
objects: lstCustomer, lstExecBroker, an Option Group named ‘fraTrader’, with
three radio buttons; optOption, optCross, optBoth. Also, I have
cboSortOrder1, cboSortOrder2, and cboSortOrder3 as well as cboSortOrder1,
cboSortOrder2, and cboSortOrder3, all of which control sort order. Finally,
here’s the code:

Private Sub cmdApplyFilter_Click()
Dim varItem As Variant
Dim strCustomer As String
Dim strExecBroker As String
Dim strTrade As String
Dim strFilter As String
Dim strSortOrder As String

DoCmd.OpenReport "Options", acViewPreview

For Each varItem In Me.lstCustomer.ItemsSelected
strCustomer = strCustomer & ",'" & Me.lstCustomer.ItemData(varItem) _
& "'"
Next varItem
If Len(strCustomer) = 0 Then
strCustomer = "Like '*'"
Else
strCustomer = Right(strCustomer, Len(strCustomer) - 1)
strCustomer = "IN(" & strCustomer & ")"
End If

For Each varItem In Me.lstExecBroker.ItemsSelected
strExecBroker = strExecBroker & ",'" &
Me.lstExecBroker.ItemData(varItem) _
& "'"
Next varItem
If Len(strExecBroker) = 0 Then
strExecBroker = "Like '*'"
Else
strExecBroker = Right(strExecBroker, Len(strExecBroker) - 1)
strExecBroker = "IN(" & strExecBroker & ")"
End If

Select Case Me.fraTrader.Value
Case 1
strTrade = "=Option"
Case 2
strTrade = "=Cross"
Case 3
strTrade = "=Stock"
End Select

strFilter = "[CustName] " & strCustomer & _
" AND [ExecBroker] " & strExecBroker & _
" AND [TradeType] " & strTrade

If Me.cboSortOrder1.Value "Not Sorted" Then
strSortOrder = "[" & Me.cboSortOrder1.Value & "]"
If Me.cmdSortDirection1.Caption = "Descending" Then
strSortOrder = strSortOrder & " DESC"
End If
If Me.cboSortOrder2.Value "Not Sorted" Then
strSortOrder = strSortOrder & ",[" & Me.cboSortOrder2.Value & "]"
If Me.cmdSortDirection2.Caption = "Descending" Then
strSortOrder = strSortOrder & " DESC"
End If
If Me.cboSortOrder3.Value "Not Sorted" Then
strSortOrder = strSortOrder & ",[" & Me.cboSortOrder3.Value
& "]"
If Me.cmdSortDirection3.Caption = "Descending" Then
strSortOrder = strSortOrder & " DESC"
End If
End If
End If
End If

With Reports![Options]
.Filter = strFilter
.FilterOn = True
.OrderBy = strSortOrder
.OrderByOn = True
End With

End Sub

If I comment that out this section:
Select Case Me.fraTrader.Value
Case 1
strTrade = "=Option"
Case 2
strTrade = "=Cross"
Case 3
strTrade = "=Stock"
End Select

As well as this:
" AND [TradeType] " & strTrade

I can filter the elements and the report works the way I want it to. For
some reason, this is wrong:
Select Case Me.fraTrader.Value
. . .
End Select

That converts the data to the wrong type, I suspect. Anyway, the report
doesn’t get filtered correctly because of this part. What do you think could
be causing this, Allen?

Thanks!
Ryan--



--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Allen Browne" wrote:

Look in:
- the Sorting And Grouping pane
- the Filter and Order By properties of the report
- the Control Source of controls (you probably looked there.)

If not found, examine the RecordSource of the report. If it's a query, try
running the query itself and see if it asks for parameters. Even if it's a
table, try opening that directly, as it could be in the table's Filter or
OrderBy properties, or the RowSource of one of its fields.

If you're still stuck, this might help you find it programmatically:
Where is a field used? - Search tables, queries, forms, reports
at:
http://allenbrowne.com/ser-73.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"ryguy7272" wrote in message
...
When I open a report I get prompted for two Parameters, FirstName and
LastName. I looked everywhere for these variables; not seeing anything at
all, but there must be something in there that’s causing this behavior.
How
can I find out where those pesky parameters are?

Thanks!
Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


.

  #4  
Old December 19th, 2009, 11:06 AM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default Pesky Parameters

Hmm: can't go through that code at present.

Best to start a new thread for a new question.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"ryguy7272" wrote in message
...
That is some really slick code, Allen!! With your code, Access was
telling
me that 'LastName' and 'FirstName' was 0. Well, I couldn’t find the
problem
so I rebuilt the report, now I am also struggling a bit of code that
dynamically filters elements in a report. I have a form with the
following
objects: lstCustomer, lstExecBroker, an Option Group named ‘fraTrader’,
with
three radio buttons; optOption, optCross, optBoth. Also, I have
cboSortOrder1, cboSortOrder2, and cboSortOrder3 as well as cboSortOrder1,
cboSortOrder2, and cboSortOrder3, all of which control sort order.
Finally,
here’s the code:

Private Sub cmdApplyFilter_Click()
Dim varItem As Variant
Dim strCustomer As String
Dim strExecBroker As String
Dim strTrade As String
Dim strFilter As String
Dim strSortOrder As String

DoCmd.OpenReport "Options", acViewPreview

For Each varItem In Me.lstCustomer.ItemsSelected
strCustomer = strCustomer & ",'" & Me.lstCustomer.ItemData(varItem)
_
& "'"
Next varItem
If Len(strCustomer) = 0 Then
strCustomer = "Like '*'"
Else
strCustomer = Right(strCustomer, Len(strCustomer) - 1)
strCustomer = "IN(" & strCustomer & ")"
End If

For Each varItem In Me.lstExecBroker.ItemsSelected
strExecBroker = strExecBroker & ",'" &
Me.lstExecBroker.ItemData(varItem) _
& "'"
Next varItem
If Len(strExecBroker) = 0 Then
strExecBroker = "Like '*'"
Else
strExecBroker = Right(strExecBroker, Len(strExecBroker) - 1)
strExecBroker = "IN(" & strExecBroker & ")"
End If

Select Case Me.fraTrader.Value
Case 1
strTrade = "=Option"
Case 2
strTrade = "=Cross"
Case 3
strTrade = "=Stock"
End Select

strFilter = "[CustName] " & strCustomer & _
" AND [ExecBroker] " & strExecBroker & _
" AND [TradeType] " & strTrade

If Me.cboSortOrder1.Value "Not Sorted" Then
strSortOrder = "[" & Me.cboSortOrder1.Value & "]"
If Me.cmdSortDirection1.Caption = "Descending" Then
strSortOrder = strSortOrder & " DESC"
End If
If Me.cboSortOrder2.Value "Not Sorted" Then
strSortOrder = strSortOrder & ",[" & Me.cboSortOrder2.Value &
"]"
If Me.cmdSortDirection2.Caption = "Descending" Then
strSortOrder = strSortOrder & " DESC"
End If
If Me.cboSortOrder3.Value "Not Sorted" Then
strSortOrder = strSortOrder & ",[" & Me.cboSortOrder3.Value
& "]"
If Me.cmdSortDirection3.Caption = "Descending" Then
strSortOrder = strSortOrder & " DESC"
End If
End If
End If
End If

With Reports![Options]
.Filter = strFilter
.FilterOn = True
.OrderBy = strSortOrder
.OrderByOn = True
End With

End Sub

If I comment that out this section:
Select Case Me.fraTrader.Value
Case 1
strTrade = "=Option"
Case 2
strTrade = "=Cross"
Case 3
strTrade = "=Stock"
End Select

As well as this:
" AND [TradeType] " & strTrade

I can filter the elements and the report works the way I want it to. For
some reason, this is wrong:
Select Case Me.fraTrader.Value
. . .
End Select

That converts the data to the wrong type, I suspect. Anyway, the report
doesn’t get filtered correctly because of this part. What do you think
could
be causing this, Allen?

Thanks!
Ryan--



--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Allen Browne" wrote:

Look in:
- the Sorting And Grouping pane
- the Filter and Order By properties of the report
- the Control Source of controls (you probably looked there.)

If not found, examine the RecordSource of the report. If it's a query,
try
running the query itself and see if it asks for parameters. Even if it's
a
table, try opening that directly, as it could be in the table's Filter or
OrderBy properties, or the RowSource of one of its fields.

If you're still stuck, this might help you find it programmatically:
Where is a field used? - Search tables, queries, forms, reports
at:
http://allenbrowne.com/ser-73.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"ryguy7272" wrote in message
...
When I open a report I get prompted for two Parameters, FirstName and
LastName. I looked everywhere for these variables; not seeing anything
at
all, but there must be something in there that’s causing this behavior.
How
can I find out where those pesky parameters are?

Thanks!
Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking
''Yes''.


.

  #5  
Old December 19th, 2009, 06:30 PM posted to microsoft.public.access.reports
ryguy7272
external usenet poster
 
Posts: 1,593
Default Pesky Parameters

Thanks for the help Allen!! Your site is a great resource!! I've used your
code many times!!

As it turns out, the code in the project that I am working on came from he
http://www.fontstuff.com/access/acctut19.htm#dialog4

I thought I recognized it. I haven't been to that site in a couple years;
almost forgot about it. Anyway, I got it working based on the tips at that
site.

Thanks for everything!
Ryan--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Allen Browne" wrote:

Hmm: can't go through that code at present.

Best to start a new thread for a new question.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"ryguy7272" wrote in message
...
That is some really slick code, Allen!! With your code, Access was
telling
me that 'LastName' and 'FirstName' was 0. Well, I couldn’t find the
problem
so I rebuilt the report, now I am also struggling a bit of code that
dynamically filters elements in a report. I have a form with the
following
objects: lstCustomer, lstExecBroker, an Option Group named ‘fraTrader’,
with
three radio buttons; optOption, optCross, optBoth. Also, I have
cboSortOrder1, cboSortOrder2, and cboSortOrder3 as well as cboSortOrder1,
cboSortOrder2, and cboSortOrder3, all of which control sort order.
Finally,
here’s the code:

Private Sub cmdApplyFilter_Click()
Dim varItem As Variant
Dim strCustomer As String
Dim strExecBroker As String
Dim strTrade As String
Dim strFilter As String
Dim strSortOrder As String

DoCmd.OpenReport "Options", acViewPreview

For Each varItem In Me.lstCustomer.ItemsSelected
strCustomer = strCustomer & ",'" & Me.lstCustomer.ItemData(varItem)
_
& "'"
Next varItem
If Len(strCustomer) = 0 Then
strCustomer = "Like '*'"
Else
strCustomer = Right(strCustomer, Len(strCustomer) - 1)
strCustomer = "IN(" & strCustomer & ")"
End If

For Each varItem In Me.lstExecBroker.ItemsSelected
strExecBroker = strExecBroker & ",'" &
Me.lstExecBroker.ItemData(varItem) _
& "'"
Next varItem
If Len(strExecBroker) = 0 Then
strExecBroker = "Like '*'"
Else
strExecBroker = Right(strExecBroker, Len(strExecBroker) - 1)
strExecBroker = "IN(" & strExecBroker & ")"
End If

Select Case Me.fraTrader.Value
Case 1
strTrade = "=Option"
Case 2
strTrade = "=Cross"
Case 3
strTrade = "=Stock"
End Select

strFilter = "[CustName] " & strCustomer & _
" AND [ExecBroker] " & strExecBroker & _
" AND [TradeType] " & strTrade

If Me.cboSortOrder1.Value "Not Sorted" Then
strSortOrder = "[" & Me.cboSortOrder1.Value & "]"
If Me.cmdSortDirection1.Caption = "Descending" Then
strSortOrder = strSortOrder & " DESC"
End If
If Me.cboSortOrder2.Value "Not Sorted" Then
strSortOrder = strSortOrder & ",[" & Me.cboSortOrder2.Value &
"]"
If Me.cmdSortDirection2.Caption = "Descending" Then
strSortOrder = strSortOrder & " DESC"
End If
If Me.cboSortOrder3.Value "Not Sorted" Then
strSortOrder = strSortOrder & ",[" & Me.cboSortOrder3.Value
& "]"
If Me.cmdSortDirection3.Caption = "Descending" Then
strSortOrder = strSortOrder & " DESC"
End If
End If
End If
End If

With Reports![Options]
.Filter = strFilter
.FilterOn = True
.OrderBy = strSortOrder
.OrderByOn = True
End With

End Sub

If I comment that out this section:
Select Case Me.fraTrader.Value
Case 1
strTrade = "=Option"
Case 2
strTrade = "=Cross"
Case 3
strTrade = "=Stock"
End Select

As well as this:
" AND [TradeType] " & strTrade

I can filter the elements and the report works the way I want it to. For
some reason, this is wrong:
Select Case Me.fraTrader.Value
. . .
End Select

That converts the data to the wrong type, I suspect. Anyway, the report
doesn’t get filtered correctly because of this part. What do you think
could
be causing this, Allen?

Thanks!
Ryan--



--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Allen Browne" wrote:

Look in:
- the Sorting And Grouping pane
- the Filter and Order By properties of the report
- the Control Source of controls (you probably looked there.)

If not found, examine the RecordSource of the report. If it's a query,
try
running the query itself and see if it asks for parameters. Even if it's
a
table, try opening that directly, as it could be in the table's Filter or
OrderBy properties, or the RowSource of one of its fields.

If you're still stuck, this might help you find it programmatically:
Where is a field used? - Search tables, queries, forms, reports
at:
http://allenbrowne.com/ser-73.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"ryguy7272" wrote in message
...
When I open a report I get prompted for two Parameters, FirstName and
LastName. I looked everywhere for these variables; not seeing anything
at
all, but there must be something in there that’s causing this behavior.
How
can I find out where those pesky parameters are?

Thanks!
Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking
''Yes''.

.

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:51 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.