A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Populate a form based on a query using parameters



 
 
Thread Tools Display Modes
  #1  
Old April 19th, 2010, 07:07 PM posted to microsoft.public.access.forms
Mommybear
external usenet poster
 
Posts: 37
Default Populate a form based on a query using parameters

I have created a form that is populated from a query. I have a text box set
up as an input box and click a button (Search) to execute the search. This
appears to be working fine as the query opens and runs. However, it displays
in the query in data format instead of in the Form I created. How do I get
this information to populate the form, not the actual query. The Search
button is set to RunQuery.
  #2  
Old April 19th, 2010, 07:33 PM posted to microsoft.public.access.forms
anthony
external usenet poster
 
Posts: 59
Default Populate a form based on a query using parameters

On Apr 19, 7:07*pm, Mommybear
wrote:
I have created a form that is populated from a query. *I have a text box set
up as an input box and click a button (Search) to execute the search. *This
appears to be working fine as the query opens and runs. *However, it displays
in the query in data format instead of in the Form I created. *How do I get
this information to populate the form, not the actual query. *The Search
button is set to RunQuery.


If I understand you correctly, you have based the form on the query ie
the form displays the data returned by the query. If so, use a combo
box on the form (when you drop the combo control on the form, the
wizard will guide you). This will take you to the record you want
  #3  
Old April 19th, 2010, 08:36 PM posted to microsoft.public.access.forms
Mommybear
external usenet poster
 
Posts: 37
Default Populate a form based on a query using parameters

There are multiple records that can be returned. Here is an example.

Type Name Location New
A camera 1st floor 1
B camera 2nd floor 0
A camera 3rd floor 1

My input is to query on the Type and return all records with that type:
Input = 'A' should return on the Form:
Type Location New
A 1st floor 1
A 3rd floor 1

I have hundreds of types, therefore a Combo box would not work.



"anthony" wrote:

On Apr 19, 7:07 pm, Mommybear
wrote:
I have created a form that is populated from a query. I have a text box set
up as an input box and click a button (Search) to execute the search. This
appears to be working fine as the query opens and runs. However, it displays
in the query in data format instead of in the Form I created. How do I get
this information to populate the form, not the actual query. The Search
button is set to RunQuery.


If I understand you correctly, you have based the form on the query ie
the form displays the data returned by the query. If so, use a combo
box on the form (when you drop the combo control on the form, the
wizard will guide you). This will take you to the record you want
.

  #4  
Old April 20th, 2010, 05:28 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Populate a form based on a query using parameters

Mommybear -

RunQuery will open a query, which is not what you want. What you want is
for this query to be the recordsource for the form. Then if you change this,
you just need to do a Me.Requery.

--
Daryl S


"Mommybear" wrote:

I have created a form that is populated from a query. I have a text box set
up as an input box and click a button (Search) to execute the search. This
appears to be working fine as the query opens and runs. However, it displays
in the query in data format instead of in the Form I created. How do I get
this information to populate the form, not the actual query. The Search
button is set to RunQuery.

  #5  
Old April 20th, 2010, 08:41 PM posted to microsoft.public.access.forms
Mommybear
external usenet poster
 
Posts: 37
Default Populate a form based on a query using parameters

It is my recordsource. I just don't know how to get the data to appear on
the form. What is a Me.Requery and where do I add this. I'm sorry, I'm
really not that familiar with Access.

"Daryl S" wrote:

Mommybear -

RunQuery will open a query, which is not what you want. What you want is
for this query to be the recordsource for the form. Then if you change this,
you just need to do a Me.Requery.

--
Daryl S


"Mommybear" wrote:

I have created a form that is populated from a query. I have a text box set
up as an input box and click a button (Search) to execute the search. This
appears to be working fine as the query opens and runs. However, it displays
in the query in data format instead of in the Form I created. How do I get
this information to populate the form, not the actual query. The Search
button is set to RunQuery.

  #6  
Old April 21st, 2010, 02:30 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Populate a form based on a query using parameters

Mommybear -

My understanding is your form is populated when you open it. Then you enter
something into a text box and click the Search button and expect the form to
now contain records based on the search criteria. If this is the case, then
in your Search button, instead of RunQuery (which will open a query in
datasheet mode in a new window), you want to re-query what is displayed in
the form based on the record source for the form. In that case, add this
code in your click event of the search button:
Me.Requery
That will cause the records on the form to be refreshed from the database
based on the current record source.

If your form is not populating at all, then make sure the controls (text
boxes, etc.) are bound to fields in the record source (the Control Source
property for each control has a field name from the query).

If you are using a main form with a subform, then let us know, as that would
mean a different answer. If this posting doesn't help, please be more
specific about what you are changing (what does the Search button do), and
what is not working...

--
Daryl S


"Mommybear" wrote:

It is my recordsource. I just don't know how to get the data to appear on
the form. What is a Me.Requery and where do I add this. I'm sorry, I'm
really not that familiar with Access.

"Daryl S" wrote:

Mommybear -

RunQuery will open a query, which is not what you want. What you want is
for this query to be the recordsource for the form. Then if you change this,
you just need to do a Me.Requery.

--
Daryl S


"Mommybear" wrote:

I have created a form that is populated from a query. I have a text box set
up as an input box and click a button (Search) to execute the search. This
appears to be working fine as the query opens and runs. However, it displays
in the query in data format instead of in the Form I created. How do I get
this information to populate the form, not the actual query. The Search
button is set to RunQuery.

  #7  
Old April 21st, 2010, 08:11 PM posted to microsoft.public.access.forms
Mommybear
external usenet poster
 
Posts: 37
Default Populate a form based on a query using parameters

My form is populated when I open it, which I really don't want it to do. I'm
just working on one problem at a time. I want it to open to a blank screen,
the user will enter the code they want to see, hit the search button, then
have the query run and the data populate. My data could be anywhere from 1+
lines so I have a header that is set up to list the info that is the same on
each record such as the code that is being searched, the item description and
category. The remaining data will display in the detail section as it defers
for each record such as location.

"Daryl S" wrote:

Mommybear -

My understanding is your form is populated when you open it. Then you enter
something into a text box and click the Search button and expect the form to
now contain records based on the search criteria. If this is the case, then
in your Search button, instead of RunQuery (which will open a query in
datasheet mode in a new window), you want to re-query what is displayed in
the form based on the record source for the form. In that case, add this
code in your click event of the search button:
Me.Requery
That will cause the records on the form to be refreshed from the database
based on the current record source.

If your form is not populating at all, then make sure the controls (text
boxes, etc.) are bound to fields in the record source (the Control Source
property for each control has a field name from the query).

If you are using a main form with a subform, then let us know, as that would
mean a different answer. If this posting doesn't help, please be more
specific about what you are changing (what does the Search button do), and
what is not working...

--
Daryl S


"Mommybear" wrote:

It is my recordsource. I just don't know how to get the data to appear on
the form. What is a Me.Requery and where do I add this. I'm sorry, I'm
really not that familiar with Access.

"Daryl S" wrote:

Mommybear -

RunQuery will open a query, which is not what you want. What you want is
for this query to be the recordsource for the form. Then if you change this,
you just need to do a Me.Requery.

--
Daryl S


"Mommybear" wrote:

I have created a form that is populated from a query. I have a text box set
up as an input box and click a button (Search) to execute the search. This
appears to be working fine as the query opens and runs. However, it displays
in the query in data format instead of in the Form I created. How do I get
this information to populate the form, not the actual query. The Search
button is set to RunQuery.

  #8  
Old April 22nd, 2010, 03:22 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Populate a form based on a query using parameters

OK, so did you put in the Me.Requery in the code behind the search button?
That should do what you want.

--
Daryl S


"Mommybear" wrote:

My form is populated when I open it, which I really don't want it to do. I'm
just working on one problem at a time. I want it to open to a blank screen,
the user will enter the code they want to see, hit the search button, then
have the query run and the data populate. My data could be anywhere from 1+
lines so I have a header that is set up to list the info that is the same on
each record such as the code that is being searched, the item description and
category. The remaining data will display in the detail section as it defers
for each record such as location.

"Daryl S" wrote:

Mommybear -

My understanding is your form is populated when you open it. Then you enter
something into a text box and click the Search button and expect the form to
now contain records based on the search criteria. If this is the case, then
in your Search button, instead of RunQuery (which will open a query in
datasheet mode in a new window), you want to re-query what is displayed in
the form based on the record source for the form. In that case, add this
code in your click event of the search button:
Me.Requery
That will cause the records on the form to be refreshed from the database
based on the current record source.

If your form is not populating at all, then make sure the controls (text
boxes, etc.) are bound to fields in the record source (the Control Source
property for each control has a field name from the query).

If you are using a main form with a subform, then let us know, as that would
mean a different answer. If this posting doesn't help, please be more
specific about what you are changing (what does the Search button do), and
what is not working...

--
Daryl S


"Mommybear" wrote:

It is my recordsource. I just don't know how to get the data to appear on
the form. What is a Me.Requery and where do I add this. I'm sorry, I'm
really not that familiar with Access.

"Daryl S" wrote:

Mommybear -

RunQuery will open a query, which is not what you want. What you want is
for this query to be the recordsource for the form. Then if you change this,
you just need to do a Me.Requery.

--
Daryl S


"Mommybear" wrote:

I have created a form that is populated from a query. I have a text box set
up as an input box and click a button (Search) to execute the search. This
appears to be working fine as the query opens and runs. However, it displays
in the query in data format instead of in the Form I created. How do I get
this information to populate the form, not the actual query. The Search
button is set to RunQuery.

  #9  
Old April 22nd, 2010, 05:39 PM posted to microsoft.public.access.forms
Mommybear
external usenet poster
 
Posts: 37
Default Populate a form based on a query using parameters

It works great. Thank you.

"Daryl S" wrote:

OK, so did you put in the Me.Requery in the code behind the search button?
That should do what you want.

--
Daryl S


"Mommybear" wrote:

My form is populated when I open it, which I really don't want it to do. I'm
just working on one problem at a time. I want it to open to a blank screen,
the user will enter the code they want to see, hit the search button, then
have the query run and the data populate. My data could be anywhere from 1+
lines so I have a header that is set up to list the info that is the same on
each record such as the code that is being searched, the item description and
category. The remaining data will display in the detail section as it defers
for each record such as location.

"Daryl S" wrote:

Mommybear -

My understanding is your form is populated when you open it. Then you enter
something into a text box and click the Search button and expect the form to
now contain records based on the search criteria. If this is the case, then
in your Search button, instead of RunQuery (which will open a query in
datasheet mode in a new window), you want to re-query what is displayed in
the form based on the record source for the form. In that case, add this
code in your click event of the search button:
Me.Requery
That will cause the records on the form to be refreshed from the database
based on the current record source.

If your form is not populating at all, then make sure the controls (text
boxes, etc.) are bound to fields in the record source (the Control Source
property for each control has a field name from the query).

If you are using a main form with a subform, then let us know, as that would
mean a different answer. If this posting doesn't help, please be more
specific about what you are changing (what does the Search button do), and
what is not working...

--
Daryl S


"Mommybear" wrote:

It is my recordsource. I just don't know how to get the data to appear on
the form. What is a Me.Requery and where do I add this. I'm sorry, I'm
really not that familiar with Access.

"Daryl S" wrote:

Mommybear -

RunQuery will open a query, which is not what you want. What you want is
for this query to be the recordsource for the form. Then if you change this,
you just need to do a Me.Requery.

--
Daryl S


"Mommybear" wrote:

I have created a form that is populated from a query. I have a text box set
up as an input box and click a button (Search) to execute the search. This
appears to be working fine as the query opens and runs. However, it displays
in the query in data format instead of in the Form I created. How do I get
this information to populate the form, not the actual query. The Search
button is set to RunQuery.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.