Re: real time query parameters
- From: bbig80524 <bbig80524@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 26 Apr 2006 13:30:02 -0700
The code is:
Option Compare Database
Option Explicit
Private Sub cmdApply_Click()
Dim varItem As Variant
Dim strJerNum As String
Dim strFilter As String
' Check that the report is open
If SysCmd(acSysCmdGetObjectState, acReport, "rptPlayerInfo") <>
acObjStateOpen Then
MsgBox "You must open the report first."
Exit Sub
End If
' Build criteria string from lstJerNum listbox
For Each varItem In Me.lstJerNum.ItemsSelected
strJerNum = strJerNum & ",'" & Me.lstJerNum.ItemData(varItem) _
& "'"
Next varItem
If Len(strJerNum) = 0 Then
strJerNum = "Like '*'"
Else
strJerNum = Right(strJerNum, Len(strJerNum) - 1)
strJerNum = "IN(" & strJerNum & ")"
End If
' Build Filter String
strFilter = "[JerNum]" & strJerNum
' Apply the filter and switch it on
With Reports![rptPlayerInfo]
.Filter = strFilter
.FilterOn = True
End With
End Sub
Private Sub cmdRemove_Click()
On Error Resume Next
' Switch the filter off
Reports![rptPlayerInfo].FilterOn = False
End Sub
"Casey via AccessMonster.com" wrote:
Double check your VBA coding. Do all of your variables match? If you want, go.
ahead and post your VBA code here and I can look through it, although I am
not expert on this matter I may be able to debug it to help you out, either
that or someone else in my office might be able to help me out come Friday.
The most common result of this error is when variable types do not match
somewhere along the way.
bbig80524 wrote:
Hi Casey,
I adopted the code for the list dialog box to my application. It almost
works. I am getting an error when I try to run the filter: "Data Type
Mismatch in Criteria Expression". I've looked at everything I can think of.
The list is a query from the same table as the report so I'm confused about
the data type mismatch. I don't know where this would be defined other than
in field tables.
Any ideas?
Thanks.
Hey Casey,[quoted text clipped - 28 lines]
I understand I could do this with a custom form but it isn't clear how this
would work. Any help you could provide would be appreciated.
--
Casey
College Student
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200604/1
- Follow-Ups:
- Re: real time query parameters
- From: bbig80524
- Re: real time query parameters
- References:
- Re: real time query parameters
- From: Casey via AccessMonster.com
- Re: real time query parameters
- From: Casey via AccessMonster.com
- Re: real time query parameters
- From: bbig80524
- Re: real time query parameters
- From: Casey via AccessMonster.com
- Re: real time query parameters
- Prev by Date: Re: real time query parameters
- Next by Date: Re: Date Selection
- Previous by thread: Re: real time query parameters
- Next by thread: Re: real time query parameters
- Index(es):
Relevant Pages
|