unexpected "Enter Parameter Value" woes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i am trying to enable my user to filter records when using a form called
"Screening Log (Edit Only)" by creating a combo box on the said form called
"fltCRA". the AfterUpdate event VBA code is jsut below:

Private Sub fltCRA_AfterUpdate()
If Me.fltCRA = "<All>" Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[CRA] = Me![fltCRA]"
End If
End Sub

the row source of the unbound combobox's is a query called lkpFormCRA and
reads:


SELECT DISTINCT [Screening Log].CRA FROM [Screening Log] UNION SELECT
"<All>" FROM [Screening Log];


in SQL.

that said, the problem is that when i use "<ALL>" , then all is well and all
the records are used, but when i use any other value in the combobox, it
issues an 'Enter Parameter Value' requesting the value of "Me!fltCAR". can
anyone see where the great bug in this is?

any help'd be really great,

-ted
 
The reference to the combobox needs to be outside of the quotes, so that it
picks up the value from the combobox.

Assuming what's in the combobox is text, use

DoCmd.ApplyFilter , "[CRA] = '" & Me![fltCRA] & "'"

Exagerated for clarity, that's

DoCmd.ApplyFilter , "[CRA] = ' " & Me![fltCRA] & " ' "

If the values in the combobox (other than <ALL>) are numeric, use

DoCmd.ApplyFilter , "[CRA] = " & Me![fltCRA]
 
hi doug,

yes, the value is text (actually it's the individual's initials), thank you
very much; it has turned off the 'alarm bells' but what still remains is the
fact that the filtering action expected isn't actually happening. does it
make any difference that the combobox is sitting in the form header of the
date entry form. when i select a value from the available CRA initials, i see
that the resulting result is a details section that is blank. the form header
however, which has the last name, first name and middle initial controls, has
empty valued controls? this is sort of weird, isn't it?

-ted

Douglas J Steele said:
The reference to the combobox needs to be outside of the quotes, so that it
picks up the value from the combobox.

Assuming what's in the combobox is text, use

DoCmd.ApplyFilter , "[CRA] = '" & Me![fltCRA] & "'"

Exagerated for clarity, that's

DoCmd.ApplyFilter , "[CRA] = ' " & Me![fltCRA] & " ' "

If the values in the combobox (other than <ALL>) are numeric, use

DoCmd.ApplyFilter , "[CRA] = " & Me![fltCRA]

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ted said:
i am trying to enable my user to filter records when using a form called
"Screening Log (Edit Only)" by creating a combo box on the said form called
"fltCRA". the AfterUpdate event VBA code is jsut below:

Private Sub fltCRA_AfterUpdate()
If Me.fltCRA = "<All>" Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[CRA] = Me![fltCRA]"
End If
End Sub

the row source of the unbound combobox's is a query called lkpFormCRA and
reads:


SELECT DISTINCT [Screening Log].CRA FROM [Screening Log] UNION SELECT
"<All>" FROM [Screening Log];


in SQL.

that said, the problem is that when i use "<ALL>" , then all is well and all
the records are used, but when i use any other value in the combobox, it
issues an 'Enter Parameter Value' requesting the value of "Me!fltCAR". can
anyone see where the great bug in this is?

any help'd be really great,

-ted
 
Answered (I hope) in microsoft.public.access.modulesdaovba.

Please don't ask the same question in more than one place!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ted said:
hi doug,

yes, the value is text (actually it's the individual's initials), thank you
very much; it has turned off the 'alarm bells' but what still remains is the
fact that the filtering action expected isn't actually happening. does it
make any difference that the combobox is sitting in the form header of the
date entry form. when i select a value from the available CRA initials, i see
that the resulting result is a details section that is blank. the form header
however, which has the last name, first name and middle initial controls, has
empty valued controls? this is sort of weird, isn't it?

-ted

Douglas J Steele said:
The reference to the combobox needs to be outside of the quotes, so that it
picks up the value from the combobox.

Assuming what's in the combobox is text, use

DoCmd.ApplyFilter , "[CRA] = '" & Me![fltCRA] & "'"

Exagerated for clarity, that's

DoCmd.ApplyFilter , "[CRA] = ' " & Me![fltCRA] & " ' "

If the values in the combobox (other than <ALL>) are numeric, use

DoCmd.ApplyFilter , "[CRA] = " & Me![fltCRA]

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ted said:
i am trying to enable my user to filter records when using a form called
"Screening Log (Edit Only)" by creating a combo box on the said form called
"fltCRA". the AfterUpdate event VBA code is jsut below:

Private Sub fltCRA_AfterUpdate()
If Me.fltCRA = "<All>" Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[CRA] = Me![fltCRA]"
End If
End Sub

the row source of the unbound combobox's is a query called lkpFormCRA and
reads:


SELECT DISTINCT [Screening Log].CRA FROM [Screening Log] UNION SELECT
"<All>" FROM [Screening Log];


in SQL.

that said, the problem is that when i use "<ALL>" , then all is well
and
all
the records are used, but when i use any other value in the combobox, it
issues an 'Enter Parameter Value' requesting the value of "Me!fltCAR". can
anyone see where the great bug in this is?

any help'd be really great,

-ted
 
Back
Top