Using this as start Parameter with a text

  • Thread starter Thread starter shaunp
  • Start date Start date
S

shaunp

How can we pass a parameter from a text box to Store Procedure in

Re: Using Parameter in query [Forms].[Form1].[txtFind]

I have a form with a text box and button and want to run an Access
query that takes an input parameter.So, is there
a way of doing this . . .


'"this is working now! "
SELECT SearchInbox.InBoxID, SearchInbox.Subject, SearchInbox.[Sender Name],
SearchInbox.Received, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE (((SearchInbox.Subject) Like "*" & [Find AuctionNumber] & "*"))
WITH OWNERACCESS OPTION;



Could it be done like this????
[Forms]![YourFormName]![YourControlName]

SELECT SearchInbox.InBoxID, SearchInbox.Subject, SearchInbox.[Sender Name],
SearchInbox.Received, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE (((SearchInbox.Subject) Like "*" & ([frmMAIN].[InboxTab].[txtFind]) &
"*"))
WITH OWNERACCESS OPTION;

Thank you in advance.
 
That should work except I would use "!" as the Separator instead of ".".
This is a fairly standard way to accomplish the task.

SELECT SearchInbox.InBoxID, SearchInbox.Subject
, SearchInbox.[Sender Name],
SearchInbox.Received
, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE SearchInbox.Subject Like "*" & [frmMAIN]![InboxTab]![txtFind] & "*"
WITH OWNERACCESS OPTION;


The form must be open for this to work, but other than that I can see no
reason for it to fail. Why don't you try it and if it fails, post back
with the error that is generated.
 
shaunp said:
How can we pass a parameter from a text box to Store Procedure in

Re: Using Parameter in query [Forms].[Form1].[txtFind]

I have a form with a text box and button and want to run an Access
query that takes an input parameter.So, is there
a way of doing this . . .


'"this is working now! "
SELECT SearchInbox.InBoxID, SearchInbox.Subject, SearchInbox.[Sender Name],
SearchInbox.Received, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE (((SearchInbox.Subject) Like "*" & [Find AuctionNumber] & "*"))
WITH OWNERACCESS OPTION;



Could it be done like this????
[Forms]![YourFormName]![YourControlName]

SELECT SearchInbox.InBoxID, SearchInbox.Subject, SearchInbox.[Sender Name],
SearchInbox.Received, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE (((SearchInbox.Subject) Like "*" & ([frmMAIN].[InboxTab].[txtFind]) &
"*"))
WITH OWNERACCESS OPTION;


Yes, it can be done, but that's not what you did. What
happened to Forms! and what is InboxTab?

It seems like that should be:

Forms!frmMAIN!txtFind
 
That should work except I would use "!" as the Separator instead of ".".
This is a fairly standard way to accomplish the task.

SELECT SearchInbox.InBoxID, SearchInbox.Subject
, SearchInbox.[Sender Name],
SearchInbox.Received
, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE SearchInbox.Subject Like "*" & [frmMAIN]![InboxTab]![txtFind] & "*"
WITH OWNERACCESS OPTION;

The form must be open for this to work, but other than that I can see no
reason for it to fail. Why don't you try it and if it fails, post back
with the error that is generated.

---
John Spencer
Access MVP 2001-2005, 2007
How can we pass a parameter from a text box to Store Procedure in
Re: Using Parameter in query [Forms].[Form1].[txtFind]
I have a form with a text box and button and want to run an Access
query that takes an input parameter.So, is there
a way of doing this . . .
'"this is working now! "
SELECT SearchInbox.InBoxID, SearchInbox.Subject, SearchInbox.[Sender Name],
SearchInbox.Received, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE (((SearchInbox.Subject) Like "*" & [Find AuctionNumber] & "*"))
WITH OWNERACCESS OPTION;
Could it be done like this????
[Forms]![YourFormName]![YourControlName]
SELECT SearchInbox.InBoxID, SearchInbox.Subject, SearchInbox.[Sender Name],
SearchInbox.Received, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE (((SearchInbox.Subject) Like "*" & ([frmMAIN].[InboxTab].[txtFind]) &
"*"))
WITH OWNERACCESS OPTION;
Thank you in advance.

work's fine but not from the text box isn't what i was hopeing for , I
would like it work from the textBox "txtFind"
But how ? .The Parameter box popped up, On Screen. Well it isn't
what I was hopeing this would hapin like this. but ,take "Number "
from the unbound text box Using it in my query! So, is there
a way of doing this . . .

Thank you in advance.
 
My fault. I missed that your reference is not quite correct.

[FORMS]![FrmMain]![TxtFind]

would be what I would expect to see. What do you believe that you are
referring to with
frmMAIN]![InboxTab]![txtFind] ?

Is InboxTab a page on a tab on your form? If so, that should not affect
the reference to the control unless you have a subform on the tab and
the control txtFind is on the subform. Try this modification

SELECT SearchInbox.InBoxID, SearchInbox.Subject
, SearchInbox.[Sender Name],
SearchInbox.Received
, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE SearchInbox.Subject Like "*" & [Forms]![frmMAIN]![txtFind] & "*"
WITH OWNERACCESS OPTION;


IF the control is on a subform, post back. I'm not sure that you can
refer to it directly in the query. I can't test this right now. But
the reference would be something like
[FORMS]![FrmMain]![Subcontrol Name].[Form]![TxtFind]
And that second Form is correct in the above.

---
John Spencer
Access MVP 2001-2005, 2007

That should work except I would use "!" as the Separator instead of ".".
This is a fairly standard way to accomplish the task.

SELECT SearchInbox.InBoxID, SearchInbox.Subject
, SearchInbox.[Sender Name],
SearchInbox.Received
, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE SearchInbox.Subject Like "*" & [frmMAIN]![InboxTab]![txtFind] & "*"
WITH OWNERACCESS OPTION;

The form must be open for this to work, but other than that I can see no
reason for it to fail. Why don't you try it and if it fails, post back
with the error that is generated.

---
John Spencer
Access MVP 2001-2005, 2007
How can we pass a parameter from a text box to Store Procedure in
Re: Using Parameter in query [Forms].[Form1].[txtFind]
I have a form with a text box and button and want to run an Access
query that takes an input parameter.So, is there
a way of doing this . . .
'"this is working now! "
SELECT SearchInbox.InBoxID, SearchInbox.Subject, SearchInbox.[Sender Name],
SearchInbox.Received, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE (((SearchInbox.Subject) Like "*" & [Find AuctionNumber] & "*"))
WITH OWNERACCESS OPTION;
Could it be done like this????
[Forms]![YourFormName]![YourControlName]
SELECT SearchInbox.InBoxID, SearchInbox.Subject, SearchInbox.[Sender Name],
SearchInbox.Received, SearchInbox.From, SearchInbox.Contents
FROM SearchInbox
WHERE (((SearchInbox.Subject) Like "*" & ([frmMAIN].[InboxTab].[txtFind]) &
"*"))
WITH OWNERACCESS OPTION;
Thank you in advance.

work's fine but not from the text box isn't what i was hopeing for , I
would like it work from the textBox "txtFind"
But how ? .The Parameter box popped up, On Screen. Well it isn't
what I was hopeing this would hapin like this. but ,take "Number "
from the unbound text box Using it in my query! So, is there
a way of doing this . . .

Thank you in advance.
 
Back
Top