DoCmd.ApplyFilter problem

D

Dorian

I have an OnClick event that does the following:
DoCmd.ApplyFilter , "[TicketNo] = " & Me!GetTicket
TicketNo is a column in my bound table and GetTicket is a textbox on the form.
When I enter a value in the textbox and click the command button, the code
works and I get the requested recond on the form.
When I call the command button Click() procedure from other code, however, I
get a prompt for parameter [TicketNo], the ApplyFilter is failing. I have
moved a valid value to GetTicket control.
Does anyone have a clue why this is happening?
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
D

Dorian

As an addendum to this....
When I single step thru the code, I get an error on the ApplyFilter line
"Error 2488" "You cant use the ApplyFilter action on this window"
I dont see this error when I run the code normally.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
D

Dorian

Putting the following line before the DoCmdApplyFilter solved the problem:

DoCmd.SelectObject acForm, "frmMyForm"

-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


Dorian said:
As an addendum to this....
When I single step thru the code, I get an error on the ApplyFilter line
"Error 2488" "You cant use the ApplyFilter action on this window"
I dont see this error when I run the code normally.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


Dorian said:
I have an OnClick event that does the following:
DoCmd.ApplyFilter , "[TicketNo] = " & Me!GetTicket
TicketNo is a column in my bound table and GetTicket is a textbox on the form.
When I enter a value in the textbox and click the command button, the code
works and I get the requested recond on the form.
When I call the command button Click() procedure from other code, however, I
get a prompt for parameter [TicketNo], the ApplyFilter is failing. I have
moved a valid value to GetTicket control.
Does anyone have a clue why this is happening?
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 

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