Reurning to a form after a query.

  • Thread starter Thread starter Tim Holmgren
  • Start date Start date
T

Tim Holmgren

Hi all,

I need some help. I'm trying to make a programming
decision in a form based on the results of a query.
Specifically, here's what I'm trying to accomplish; I've
created a form and a query to search the "Do Not Call"
list. I've imported the DNC list into a table and I've
created a form and a query so that, in the form, I can
enter the phone number I want to call and use the query to
search the table.

The form and the query work. If the number is on the
list, it is displayed in a query result window. If it
does not exist, I get an empty query result window. What
I am trying to accomplish is to then return to my form and
display a message window letting the user know whether the
number was found our not.

I hope that is enough info for someone to give me some
direction. Thanx.

Tim
 
Hi all,

I need some help. I'm trying to make a programming
decision in a form based on the results of a query.
Specifically, here's what I'm trying to accomplish; I've
created a form and a query to search the "Do Not Call"
list. I've imported the DNC list into a table and I've
created a form and a query so that, in the form, I can
enter the phone number I want to call and use the query to
search the table.

The form and the query work. If the number is on the
list, it is displayed in a query result window. If it
does not exist, I get an empty query result window. What
I am trying to accomplish is to then return to my form and
display a message window letting the user know whether the
number was found our not.

I hope that is enough info for someone to give me some
direction. Thanx.

Tim

Tim,
You do not need to leave the form to run the query if all you wish to
know is if that phone number is on the list.

On the Form, add an unbound control to be used to display the message.
Set it's Control source to:
=IIf(DLookUp("[EnterPhoneNumControl]","QueryName") is not Null,"This
Number is on the list","This number is NOT on the list")

You never see the query at all, and you never leave the form.

Another method is to use a combo box with it's rowsource set to:
"Select Distinct YourTable.[PhoneNum] From YourTable Order By
[PhoneNum];"

Set the control's AutoExpand property to Yes.
Limit To List property to No.

Leave the Control Source unbound.
Use this control to enter the number.
As you start entering the phone number in the control, it will find
the number for you. If it doesn't find the number you'll know that
it's not in the list.

If your DNC list is very large, you can break the number of records
returned into smaller manageable numbers as you enter them.
 
Back
Top