469,266 Members | 1,768 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,266 developers. It's quick & easy.

I need to have my query results displayed in a subform.

ChaseCox
294 100+
I have a form that I use to input criteria that I have then being passed into a query. Currently the query saves the results as an excell file. I would also like to have the results show up in the form, I guess as a subform. If this is possible I would love some assitance on this. Thanks to all of you who have helped me so far.
Jan 4 '07 #1
32 18252
MMcCarthy
14,534 Expert Mod 8TB
I have a form that I use to input criteria that I have then being passed into a query. Currently the query saves the results as an excell file. I would also like to have the results show up in the form, I guess as a subform. If this is possible I would love some assitance on this. Thanks to all of you who have helped me so far.
Create an unbound subform based on this query and don't bind it to the main form with any master child relationship.

You will need to requery the subform in code somewhere maybe behind a command button.

Expand|Select|Wrap|Line Numbers
  1. Me.subformObjectName.Requery
Mary
Jan 5 '07 #2
ChaseCox
294 100+
Create an unbound subform based on this query and don't bind it to the main form with any master child relationship.

You will need to requery the subform in code somewhere maybe behind a command button.

Expand|Select|Wrap|Line Numbers
  1. Me.subformObjectName.Requery
Mary

Sorry, but how would I do that exactly? <--Newb
Jan 5 '07 #3
ChaseCox
294 100+
Create an unbound subform based on this query and don't bind it to the main form with any master child relationship.

You will need to requery the subform in code somewhere maybe behind a command button.

Expand|Select|Wrap|Line Numbers
  1. Me.subformObjectName.Requery
Mary
What do I put in for the Me part of your code, and where does it go?
Jan 5 '07 #4
ChaseCox
294 100+
What do I put in for the Me part of your code, and where does it go?

i also set up the sub form to be independent of the main form. I need the subform however only to populate when I run the query from the main form, to save on load time.
Jan 5 '07 #5
ChaseCox
294 100+
I am using this:

DoCmd.OutputTo acOutputQuery, "TestQuery", acFormatXLS, "", False

to output to an excell file
Jan 5 '07 #6
MMcCarthy
14,534 Expert Mod 8TB
i also set up the sub form to be independent of the main form. I need the subform however only to populate when I run the query from the main form, to save on load time.
thats what the Me.subformObjectname.Requery is for.

Put a command button on the form to run the query (use the wizzard) and then add this line of code substituting the subformObjectname.

Mary
Jan 5 '07 #7
ChaseCox
294 100+
thats what the Me.subformObjectname.Requery is for.

Put a command button on the form to run the query (use the wizzard) and then add this line of code substituting the subformObjectname.

Mary
You are a life saver thank you so much!!!

is there a way to keep that subform from running until I click that query button?
Jan 5 '07 #8
MMcCarthy
14,534 Expert Mod 8TB
You are a life saver thank you so much!!!

is there a way to keep that subform from running until I click that query button?
It will run when the form opens and shouldn't run again until the button is clicked.
Jan 5 '07 #9
ChaseCox
294 100+
It will run when the form opens and shouldn't run again until the button is clicked.
Yes that is what it does now. But the query, unrestricted, could take A LONG time to run. is there a way to prevent this?
Jan 5 '07 #10
ChaseCox
294 100+
Yes that is what it does now. But the query, unrestricted, could take A LONG time to run. is there a way to prevent this?

Right now the table is only about 7,000 records. This from will be used to query tables much, much, larger.
Jan 5 '07 #11
MMcCarthy
14,534 Expert Mod 8TB
Yes that is what it does now. But the query, unrestricted, could take A LONG time to run. is there a way to prevent this?
You could try leaving the Record Source of the Subform blank and add it as a line of code in the command button before the requery.

Expand|Select|Wrap|Line Numbers
  1. Forms![MainFormName]![SubformName].Form.RecordSource = "qryName"
Jan 5 '07 #12
ChaseCox
294 100+
You could try leaving the Record Source of the Subform blank and add it as a line of code in the command button before the requery.

Expand|Select|Wrap|Line Numbers
  1. Forms![MainFormName]![SubformName].Form.RecordSource = "qryName"
WOW! you are awesome!!! How do you know so much about this? I am amazed at your knowledge of this Program!
Jan 5 '07 #13
MMcCarthy
14,534 Expert Mod 8TB
WOW! you are awesome!!! How do you know so much about this? I am amazed at your knowledge of this Program!
Years of experience. We all have to learn. You'll get there.

Mary
Jan 5 '07 #14
ChaseCox
294 100+
I was also wanting to know about having the ability to point this form at a database inside the form. Is this possible. It will only be used by myself and a coworker, so the danger may be reduced. Any thoughts?
Jan 5 '07 #15
MMcCarthy
14,534 Expert Mod 8TB
I was also wanting to know about having the ability to point this form at a database inside the form. Is this possible. It will only be used by myself and a coworker, so the danger may be reduced. Any thoughts?
Sorry Chase

I don't understand the question?

Mary
Jan 6 '07 #16
NeoPa
32,171 Expert Mod 16PB
I was also wanting to know about having the ability to point this form at a database inside the form. Is this possible. It will only be used by myself and a coworker, so the danger may be reduced. Any thoughts?
Are you asking about using a table from a different database within the form?
It's not clear I'm afraid from your post.
Jan 7 '07 #17
ChaseCox
294 100+
Are you asking about using a table from a different database within the form?
It's not clear I'm afraid from your post.

My form/query needs to look at several tables, but only one at a time. Each table contains information on a seperate product line, however each table has the same information, all labeled the same. Is it possible to select which DB you look at?
Jan 8 '07 #18
NeoPa
32,171 Expert Mod 16PB
I'll take that as a 'No' then.
What you need to do then (I would suggest) is to set the RecordSource of the form when you've determined which table you need to bind to. After setting it you may well need to do a ReQuery on the form (Call Me.reQuery).
NB. There is a difference between a Table and a Database.
A database contains tables, as well as many other object types.
Jan 8 '07 #19
ChaseCox
294 100+
I'll take that as a 'No' then.
What you need to do then (I would suggest) is to set the RecordSource of the form when you've determined which table you need to bind to. After setting it you may well need to do a ReQuery on the form (Call Me.reQuery).
Where do I go to change the record source. I was trying to go through the SQL code of the query the form is populating and change every instance of the DB name and replacing it with the value I place into a combo box. Is there an easier way?
Jan 8 '07 #20
NeoPa
32,171 Expert Mod 16PB
You don't seem to be following what I'm saying here.
1. What are you referring to? Tables or databases?

In your latest post (#20) you refer to a ComboBox. This is the first mention of it that I can find.
How do you expect anyone to answer your questions when they keep changing and you don't respond to requests for clarification but just go on your own sweet way?
It is now unclear what you're wanting to do as well as what you want to do it to.
Please try to clear this up as I don't want to be dealing with this question in days to come.
Jan 8 '07 #21
ChaseCox
294 100+
I want my form to be able to look at different databases. I would like to have the option to select the DB from a dropdown menu, or maybe by checking a box. I am not sure how else to word my request.

My form is providing the criteria for my query which is looking at the DB.

I am as confused as you are apparently. I really need some help on this. Sorry if I am confusing people.
Jan 8 '07 #22
NeoPa
32,171 Expert Mod 16PB
OK let's take this slowly.
Do you understand the difference between a database and a table (You must answer questions when they are posted if you want people to work with you)?
If so then we need to know that. Your question seemed to switch between the two as if you assumed they were indifferentiable (the same).
You are, presumably, showing details on a form for a particular type of record (from one of similar tables). On this form you also have a ComboBox from which the operator should select the particular table to be used at the time. I suggest you need to have all the tables available in your front-end database (the one the form is run from). If any are from other (back-end) databases then their tables should be linked into this one so that all are available to this one.
How is your ComboBox populated with the table names (You need to answer this question too)?
When the operator has selected an entry from the ComboBox (This will trigger an AfterUpdate event in which you can place some code), you need to set the RecordSource of the form and ReQuery it.
If you would like some help putting the code together for this you will also need to provide the names of the Form and the ComboBox control on the form.
Jan 8 '07 #23
ChaseCox
294 100+
Do you understand the difference between a database and a table (You must answer questions when they are posted if you want people to work with you)?
I am not aware of the difference.

Your question seemed to switch between the two as if you assumed they were indifferentiable (the same).

Thank you for delineating this. (defining)

I do not control the DB's. I am trying to search through them to get the info I need.
How is your ComboBox populated with the table names (You need to answer this question too)?

I do not know how to populate the combobox with the names. I am not sure of how to do this.
Jan 8 '07 #24
NeoPa
32,171 Expert Mod 16PB
I gave a basic description of the difference in Post #19 but here is another.
A database is (generally) a file which contains various types of object within it. One of those object types (usually contains many of this particular type) is a table. A table contains data grouped together by Record (Row) and Field (Column).
For instance you may have a Customer Table which contains an ID field; a Name field and some Address fields. Every customer in this table can have an ID; a Name and some Address data. Another table, inside the same database could be a Supplier table which would contain its own fields and all the records in it could have data in all those fields.
Queries; Forms; Reports; etc are other types of objects that can be stored inside a database with (but not inside) the tables.

Assuming that you need to select TABLES rather than DATABASES in your ComboBox, we probably need to look at the possibility of storing your data in a single table, but with a field added to differentiate between your different types of data.
Before we go on, let me know if any of this makes sense to you.
Jan 8 '07 #25
ChaseCox
294 100+
Ok I am following you. I am working in something called the Falcon Database. I understand now that I am looking at tables within that Database. So I need to be able to dynamicaly change which table the form looks at.

I do not think I can store all of the data in one table, since each table is updated independently of eachother by someone other than myself.
Jan 9 '07 #26
NeoPa
32,171 Expert Mod 16PB
OK. That's a lot clearer now :)
Do you know which tables are to be included in the list?
If so, please post the full list of them.
If not, please indicate how to determine which tables to select from among all the tables you have available (in your database).
Jan 9 '07 #27
ChaseCox
294 100+
OK. That's a lot clearer now :)
Do you know which tables are to be included in the list?
If so, please post the full list of them.
If not, please indicate how to determine which tables to select from among all the tables you have available (in your database).

Not at the moment, I would guess there would be about 9 or 10. I will know more after todays meeting. I will told which tables to include.
Jan 9 '07 #28
ChaseCox
294 100+
it may be possible to load all of the tables into one. I will let you all know after lunch. Thanks.
Jan 9 '07 #29
NeoPa
32,171 Expert Mod 16PB
Lunch?
It's nearly time to go home.
It sounds like we have a static list anyway. That's quite straightforward to deal with when you let me know the list (As exact and precisely as possible). Please use [] around the table names.
Jan 9 '07 #30
ChaseCox
294 100+
I think I may have found a way around this current situation. Maybe not. The meeting I had changed the direction of my project, so I am not sure I need it do what I said it should do.
Jan 9 '07 #31
NeoPa
32,171 Expert Mod 16PB
In that case I suggest that you leave this thread as it is.
If you need further help on a similar issue you can create a new thread (topic) and put a link to this one within it if necessary.
Good luck with your project.
Jan 9 '07 #32
NeoPa
32,171 Expert Mod 16PB
NB. Notice my more mellow attitude.
This is due to the fact that I am now at home with a cup of tea (with mandatory biscuit) in front of me half-drunk (The tea - not me ;) ).
Jan 9 '07 #33

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Jeremiah J. Burton | last post: by
2 posts views Thread by Susan Bricker | last post: by
2 posts views Thread by Anja | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.