Is there away

  • Thread starter ryan.fitzpatrick3
  • Start date
R

ryan.fitzpatrick3

I have a query that pulls from a database which records onto a table.
then I have a form whichs pulls data off of that table. on the form i
have comboboxes with various information to sort by. Is there away to
have the combobox selections run the query which populates the table
which then populates the form? this make sense.

or another way would be: The query that runs off of the database is
linked, so everytime you run the query you need to input a password,
is there away to have it not linked until you do the run query button?
 
P

Piet Linden

I have a query that pulls from a database which records onto a table.
then I have a form whichs pulls data off of that table. on the form i
have comboboxes with various information to sort by. Is there away to
have the combobox selections run the query which populates the table
which then populates the form? this make sense.

or another way would be: The query that runs off of the database is
linked, so everytime you run the query you need to input a password,
is there away to have it not linked until you do the run query button?

yes. put code in the afterupdate event of the combobox. Seems like
a weird thing to do... what are you really trying to accomplish in
business terms?

If you're appending records..

'--run the query
DBEngine(0)(0).Execute "actionquery", dbFailOnError
'--requery the form's recordsource.
Me.Requery
 
R

ryan.fitzpatrick3

I want to pull information out of my database at work. when I link the
recordsource of the form to the query that is linked to the database
it automatically prompts password on form entry, and since no criteria
is set (in the comboboxes) it'll want to pull everything which will
freeze the comp.
 
J

John W. Vinson

I have a query that pulls from a database which records onto a table.
then I have a form whichs pulls data off of that table. on the form i
have comboboxes with various information to sort by. Is there away to
have the combobox selections run the query which populates the table
which then populates the form? this make sense.

or another way would be: The query that runs off of the database is
linked, so everytime you run the query you need to input a password,
is there away to have it not linked until you do the run query button?

A form isn't really "populated" - it's a window, a tool that lets you see data
in its Recordsource. The recordsource might be a table but it's more often a
Query; if you want to display the data in a particular sort order, you'ld
either base the form on a query sorted by that field (or fields), or set the
form's OrderBy property to the fieldnames and its OrderByOn property to yes.

You would not (ordinarily) run a query OR populate a table just in order to
view data on a form. It sounds like you just need to use a bit of code in the
combo boxes' AfterUpdate event to either change the form's Recordsource, or
change its OrderBy property.

Are you perhaps using the word "sort" in its common incorrect vernacular usage
meaning "to filter or select"? Sort (in database jargon) means "to put a set
of records into a specified sequential order". Which are you trying to do?
 
R

ryan.fitzpatrick3

Yes I was referring sort as filter. Thanks for the insight, I'm still
unsure what to do because I'm a beginner in Access. if you think you
understand my question how would you attempt to achieve what I'm
looking for?
 
J

John W. Vinson

I have a query that pulls from a database which records onto a table.
then I have a form whichs pulls data off of that table. on the form i
have comboboxes with various information to sort by. Is there away to
have the combobox selections run the query which populates the table
which then populates the form? this make sense.

or another way would be: The query that runs off of the database is
linked, so everytime you run the query you need to input a password,
is there away to have it not linked until you do the run query button?

You need to use File... Get External Data... Link to set up a all-session-long
link to the remote table, and then use a Query based on a form to retrieve the
desired records. You can use query criteria like

=[Forms]![NameOfForm]![NameOfCombo]

to use the value of a combo box as a search criterion. The combo needs to be
*UNBOUND* (nothing in its Control Source property) for this to work.

For some examples of how this can be done see
http://allenbrowne.com/ser-62.html
http://www.mvps.org/access/forms/frm0045.htm
 

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