Search feom a TextBox Entry

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

Guest

I have searched these forums and not found a solutions that answers my
problem. I have a form with a text box (txtInput) and a Search button
(cmdSearch). I have attached the following code to the "Click" event of the
button.

When I enter a valid ID into the textbox and click the search button I get a
"Parameter Value" dialog box up that I have to re-enter my valid ID into
before the required form opens with the records that match the ID entered.

I don't want the Parameter Value dialog box to open. I want the code to
simply use the value entered into the text box, txtInput, and then open the
desired form with only those records. Can someone tell me where I'm going
wrong please.


txtInput.SetFocus

if not isnull(me.txtInput) then
docmd.OpenForm "frmOutput", , , "CTC_ID = " & txtInput.text
else
msgbox "Nothing Selected"
end if

Many thanks,
Ian.
 
In your query, is the criteria for the field CTC_ID set to something along
the lines of [Forms]![NameOfForm].[txtInput]?
That should make frmOutput's underlying query get the required parameter
without prompting you.
Another possibility is a typo.
 
Hey, thanks for your reply and apologies for the delay in responding. I tried
as you suggested and looked for typo's but I'm still getting the prompting
dialog box. I looked through the VBA help files and their suggestions didn't
work either.

I wonder if you have any other suggestions or can point me to a site maybe
that describes what I'm trying to accomplish?

Thanks again,
Ian.


StrayBullet via AccessMonster.com said:
In your query, is the criteria for the field CTC_ID set to something along
the lines of [Forms]![NameOfForm].[txtInput]?
That should make frmOutput's underlying query get the required parameter
without prompting you.
Another possibility is a typo.
I have searched these forums and not found a solutions that answers my
problem. I have a form with a text box (txtInput) and a Search button
(cmdSearch). I have attached the following code to the "Click" event of the
button.

When I enter a valid ID into the textbox and click the search button I get a
"Parameter Value" dialog box up that I have to re-enter my valid ID into
before the required form opens with the records that match the ID entered.

I don't want the Parameter Value dialog box to open. I want the code to
simply use the value entered into the text box, txtInput, and then open the
desired form with only those records. Can someone tell me where I'm going
wrong please.

txtInput.SetFocus

if not isnull(me.txtInput) then
docmd.OpenForm "frmOutput", , , "CTC_ID = " & txtInput.text
else
msgbox "Nothing Selected"
end if

Many thanks,
Ian.
 
One other thing it might be, is the form with the search button remaining
open as frmOutput opens?
Hey, thanks for your reply and apologies for the delay in responding. I tried
as you suggested and looked for typo's but I'm still getting the prompting
dialog box. I looked through the VBA help files and their suggestions didn't
work either.

I wonder if you have any other suggestions or can point me to a site maybe
that describes what I'm trying to accomplish?

Thanks again,
Ian.
In your query, is the criteria for the field CTC_ID set to something along
the lines of [Forms]![NameOfForm].[txtInput]?
[quoted text clipped - 26 lines]
 
Back
Top