Submit Button for a Form?

G

Guest

I need to create a submit button that will move a text string from a text box
on a form and enter it into a query statement.

I am learning Microsoft Access. I have created a query where the user must
enter a text string to pull information out of a table. Currently this is
set up with this statement…

Like '*' & [Text String Goes Here] & '*'

I would now like to take this to the next level by putting the results of
the query into a form and also by placing a control in the form that will
allow me to supply the text string for the query.

I believe I have solved most of what is needed. I have the ability to
design the form to display the results of a query. I also believe that if I
replace the square brackets in the query to input the text string from the
form required by the “like†statement I would just replace the square
brackets in the “like†statement with criteria like this…

[Forms]![NameOfYourForm]![NameOfControlOnYourForm]

It would then look like this…

Like '*' & [Forms]![NameOfYourForm]![NameOfControlOnYourForm] & '*'

Is that right?

The last piece of the puzzle now is to design a submit button that will run
the query. Right? I know how to place the button, but I do not know how to
make it function. Are my assumptions on the basic procedures correct? I
really look forward to being able to do this.

Quin
 
C

Craig Hornish

You are close to the right idea but your first sentance is probably
incorrect. I have had the need to make the criteria differnent but that is
an advanced subject.

So you put this into the fields 'Criteria' in the query that is either in
the Report or Forms 'Record Source' property or the Query that that it is
based on.
Like '*' & [Forms]![NameOfYourForm]![NameOfControlOnYourForm] & '*'

The control button you metion then opens the Report / or Query(not really
used that much) and you see the information that is "Like" what was entered
into the control.
DoCmd.OpenReport "NameOfReport" , acPreview

If it the forms query then you need to requery the form
Me.Requery
Becuase you are using the Like - it will show all records when you open the
form for the first time.

HTH
--
Craig Hornish

Visit weekly Access conferences
Tuesday, 11:00am-12:30pm (Eastern US)
Thursday, 3:30pm- 5:00pm (Eastern US)

http://community.compuserve.com/n/pfx/forum.aspx?webtag=ws-msdevapps

"Think outside the box, because anything is possible."
"How long it will take or whether it requires divine intervention is another
issue"
 
G

Guest

Craig,

I am sorry but I do not understand your reply. How do I get the Button to
run the query?



Craig Hornish said:
You are close to the right idea but your first sentance is probably
incorrect. I have had the need to make the criteria differnent but that is
an advanced subject.

So you put this into the fields 'Criteria' in the query that is either in
the Report or Forms 'Record Source' property or the Query that that it is
based on.
Like '*' & [Forms]![NameOfYourForm]![NameOfControlOnYourForm] & '*'

The control button you metion then opens the Report / or Query(not really
used that much) and you see the information that is "Like" what was entered
into the control.
DoCmd.OpenReport "NameOfReport" , acPreview

If it the forms query then you need to requery the form
Me.Requery
Becuase you are using the Like - it will show all records when you open the
form for the first time.

HTH
--
Craig Hornish

Visit weekly Access conferences
Tuesday, 11:00am-12:30pm (Eastern US)
Thursday, 3:30pm- 5:00pm (Eastern US)

http://community.compuserve.com/n/pfx/forum.aspx?webtag=ws-msdevapps

"Think outside the box, because anything is possible."
"How long it will take or whether it requires divine intervention is another
issue"

Quin said:
I need to create a submit button that will move a text string from a text
box
on a form and enter it into a query statement.

I am learning Microsoft Access. I have created a query where the user
must
enter a text string to pull information out of a table. Currently this is
set up with this statement.

Like '*' & [Text String Goes Here] & '*'

I would now like to take this to the next level by putting the results of
the query into a form and also by placing a control in the form that will
allow me to supply the text string for the query.

I believe I have solved most of what is needed. I have the ability to
design the form to display the results of a query. I also believe that if
I
replace the square brackets in the query to input the text string from the
form required by the "like" statement I would just replace the square
brackets in the "like" statement with criteria like this.

[Forms]![NameOfYourForm]![NameOfControlOnYourForm]

It would then look like this.

Like '*' & [Forms]![NameOfYourForm]![NameOfControlOnYourForm] & '*'

Is that right?

The last piece of the puzzle now is to design a submit button that will
run
the query. Right? I know how to place the button, but I do not know how
to
make it function. Are my assumptions on the basic procedures correct? I
really look forward to being able to do this.

Quin
 
C

Craig Hornish

One aspect of myself is that I try to convey as many possibilities as
possible. This can be a double edge sword.

It is possible to open a query by itself to show information, but as
someone who is new you should only be showing information to your users with
only forms or reports. The queries that they are based upon with work fine
as I described.

If you have further quesitons please describe how you wish to present
the data and what you have finished so far. It sounds like you want to use
a form.

--
Craig Hornish

Visit weekly Access conferences
Tuesday, 11:00am-12:30pm (Eastern US)
Thursday, 3:30pm- 5:00pm (Eastern US)

http://community.compuserve.com/n/pfx/forum.aspx?webtag=ws-msdevapps

"Think outside the box, because anything is possible."
"How long it will take or whether it requires divine intervention is another
issue"

Quin said:
Craig,

I am sorry but I do not understand your reply. How do I get the Button to
run the query?



Craig Hornish said:
You are close to the right idea but your first sentance is probably
incorrect. I have had the need to make the criteria differnent but that
is
an advanced subject.

So you put this into the fields 'Criteria' in the query that is either in
the Report or Forms 'Record Source' property or the Query that that it is
based on.
Like '*' & [Forms]![NameOfYourForm]![NameOfControlOnYourForm] & '*'

The control button you metion then opens the Report / or Query(not really
used that much) and you see the information that is "Like" what was
entered
into the control.
DoCmd.OpenReport "NameOfReport" , acPreview

If it the forms query then you need to requery the form
Me.Requery
Becuase you are using the Like - it will show all records when you open
the
form for the first time.

HTH
--
Craig Hornish

Visit weekly Access conferences
Tuesday, 11:00am-12:30pm (Eastern US)
Thursday, 3:30pm- 5:00pm (Eastern US)

http://community.compuserve.com/n/pfx/forum.aspx?webtag=ws-msdevapps

"Think outside the box, because anything is possible."
"How long it will take or whether it requires divine intervention is
another
issue"

Quin said:
I need to create a submit button that will move a text string from a
text
box
on a form and enter it into a query statement.

I am learning Microsoft Access. I have created a query where the user
must
enter a text string to pull information out of a table. Currently this
is
set up with this statement.

Like '*' & [Text String Goes Here] & '*'

I would now like to take this to the next level by putting the results
of
the query into a form and also by placing a control in the form that
will
allow me to supply the text string for the query.

I believe I have solved most of what is needed. I have the ability to
design the form to display the results of a query. I also believe that
if
I
replace the square brackets in the query to input the text string from
the
form required by the "like" statement I would just replace the square
brackets in the "like" statement with criteria like this.

[Forms]![NameOfYourForm]![NameOfControlOnYourForm]

It would then look like this.

Like '*' & [Forms]![NameOfYourForm]![NameOfControlOnYourForm] & '*'

Is that right?

The last piece of the puzzle now is to design a submit button that will
run
the query. Right? I know how to place the button, but I do not know
how
to
make it function. Are my assumptions on the basic procedures correct?
I
really look forward to being able to do this.

Quin
 
G

Guest

I have more than one thread going relating to this question in hopes of
getting to the answer. I hope that is ok with everyone...

Let me be specific as to exactly what I am hoping to accomplish with this
project. I have about 300 employees that work Day shift, Swing Shift, and
Graveyard shift. Many of them have names that are hard to remember or
pronounce.

I would like to be able to type part of a name into a box and return a match
for everyone out of the group that matches. My associated table contains
information about what shift the employee works, his days off, which
supervisor he reports to, what section he works in etc.

I have worked out (with some help from MVP John Vinson) a query that I feel
is ideal for accomplishing this. The criteria is:

Like ‘*’& [Enter Part of Employee Name ] &‘*’

I can also repeat this on the OR line and Access will search both First
Names and Last Names and return a few lines with employees that match with
the wild card criteria. All the user needs is to remember part of the name,
just enough to narrow down the results.

For this, a combo box will not work. I need a text box and I think that if I
base the form on the query I will get the results from the query that I want
if I can just input the wildcard criteria. I would not expect a user of this
to work under the query tab so it needs to be a form where criteria is input
and results are viewed.

I am so close but so far away because I know how to make the query, I think
I know how to make the form based upon the query. I know how to place
controls but I can’t make the [censored] control accept an input to make it
all happen!




Craig Hornish said:
One aspect of myself is that I try to convey as many possibilities as
possible. This can be a double edge sword.

It is possible to open a query by itself to show information, but as
someone who is new you should only be showing information to your users with
only forms or reports. The queries that they are based upon with work fine
as I described.

If you have further quesitons please describe how you wish to present
the data and what you have finished so far. It sounds like you want to use
a form.

--
Craig Hornish

Visit weekly Access conferences
Tuesday, 11:00am-12:30pm (Eastern US)
Thursday, 3:30pm- 5:00pm (Eastern US)

http://community.compuserve.com/n/pfx/forum.aspx?webtag=ws-msdevapps

"Think outside the box, because anything is possible."
"How long it will take or whether it requires divine intervention is another
issue"

Quin said:
Craig,

I am sorry but I do not understand your reply. How do I get the Button to
run the query?



Craig Hornish said:
You are close to the right idea but your first sentance is probably
incorrect. I have had the need to make the criteria differnent but that
is
an advanced subject.

So you put this into the fields 'Criteria' in the query that is either in
the Report or Forms 'Record Source' property or the Query that that it is
based on.
Like '*' & [Forms]![NameOfYourForm]![NameOfControlOnYourForm] & '*'

The control button you metion then opens the Report / or Query(not really
used that much) and you see the information that is "Like" what was
entered
into the control.
DoCmd.OpenReport "NameOfReport" , acPreview

If it the forms query then you need to requery the form
Me.Requery
Becuase you are using the Like - it will show all records when you open
the
form for the first time.

HTH
--
Craig Hornish

Visit weekly Access conferences
Tuesday, 11:00am-12:30pm (Eastern US)
Thursday, 3:30pm- 5:00pm (Eastern US)

http://community.compuserve.com/n/pfx/forum.aspx?webtag=ws-msdevapps

"Think outside the box, because anything is possible."
"How long it will take or whether it requires divine intervention is
another
issue"

I need to create a submit button that will move a text string from a
text
box
on a form and enter it into a query statement.

I am learning Microsoft Access. I have created a query where the user
must
enter a text string to pull information out of a table. Currently this
is
set up with this statement.

Like '*' & [Text String Goes Here] & '*'

I would now like to take this to the next level by putting the results
of
the query into a form and also by placing a control in the form that
will
allow me to supply the text string for the query.

I believe I have solved most of what is needed. I have the ability to
design the form to display the results of a query. I also believe that
if
I
replace the square brackets in the query to input the text string from
the
form required by the "like" statement I would just replace the square
brackets in the "like" statement with criteria like this.

[Forms]![NameOfYourForm]![NameOfControlOnYourForm]

It would then look like this.

Like '*' & [Forms]![NameOfYourForm]![NameOfControlOnYourForm] & '*'

Is that right?

The last piece of the puzzle now is to design a submit button that will
run
the query. Right? I know how to place the button, but I do not know
how
to
make it function. Are my assumptions on the basic procedures correct?
I
really look forward to being able to do this.

Quin
 

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