access query results with multiple rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I run a query, I will get multiple rows of results (multiple records)
via a spreadsheet format. I would like to access every cell in the query
results and copy the data to a specific textbox on a form. If I have 5 rows
of results consisting ot 5 columns of actual data then I would be loading 25
individual text cells.

The problem is I do not know how to access a query result in spreadsheet
format and read the data from each row-column cell and then place the results
on a specifc form with textboxes.


Thanks for the help.

Bill
 
A query results gives you a datasheet view and a form properties can be set
to datasheet view. What other do you need? Post an example of what you
would like.
 
Bill said:
When I run a query, I will get multiple rows of results (multiple records)
via a spreadsheet format. I would like to access every cell in the query
results and copy the data to a specific textbox on a form. If I have 5
rows
of results consisting ot 5 columns of actual data then I would be loading
25
individual text cells.

The problem is I do not know how to access a query result in spreadsheet
format and read the data from each row-column cell and then place the
results
on a specifc form with textboxes.


Thanks for the help.

Bill

It sounds like you could use Continuous view for your form. That way, each
row is repeated as many times as necessary (depending on how many rows are
returned). Design a form with a single set of textboxes (one for each field
in a single row of the query) and set its Default View property to
Continuous Forms. Specify the query as the Record Source for the form, and
you should be ready to go.

Carl Rapson
 
Karl:

In short, I am storing medication information on each patient in the form of
name, ID number, medication, strenght, dose, frequency and a few other
parameters. All of this forms a record. One record for each medication.
What I want to do is do a search for a specific patient by his/her ID number.
Most patients will be on multiple medications with the query showing one
medicaiton record per row in a datasheet format.

What I want to do is to obtain the query results and move all of that
information from a query spreadsheet view to a form view with multiple copies
of a record. The form will hold up to 10 or 12 copies of blank records which
I want to fill with the query results. I plan to use textboxes to hold the
query view data results.

The question is how to move data from a query result in spreadsheet format
to a form and placing that data into a textbox.

I can link the blank record on the form to the query results but that only
shows me the current showing record in the result query. It does not allow
me to link row 2 to blank record 2 on the form or row 3 to blank record 3 on
the form.

I figure I will have to do all of this using a VB macro within access 2003
itself.

Bill
 
I see now but what you need is a form (patient) and subform (medication)
using the PatientID number as Master/Child Link. The subform can be
datasheet view or Continuous view.

Also see post by Carl Rapson.
 
When I run a query, I will get multiple rows of results (multiple records)
via a spreadsheet format. I would like to access every cell in the query
results and copy the data to a specific textbox on a form. If I have 5 rows
of results consisting ot 5 columns of actual data then I would be loading 25
individual text cells.

The problem is I do not know how to access a query result in spreadsheet
format and read the data from each row-column cell and then place the results
on a specifc form with textboxes.

This is going to be really, really difficult. Do you want to completely
redesign the form with every run of the query - i.e. if it returns four rows
you want 20 textboxes, 6 rows 30, 105 rows 525 textboxes?

Could you not instead simply use a form in datasheet view, based on the query,
to have it *display* as many rows as are needed, with scrollbars and
everything?

John W. Vinson [MVP]
 
In short, I am storing medication information on each patient in the form of
name, ID number, medication, strenght, dose, frequency and a few other
parameters. All of this forms a record. One record for each medication.
What I want to do is do a search for a specific patient by his/her ID number.
Most patients will be on multiple medications with the query showing one
medicaiton record per row in a datasheet format.

What I want to do is to obtain the query results and move all of that
information from a query spreadsheet view to a form view with multiple copies
of a record. The form will hold up to 10 or 12 copies of blank records which
I want to fill with the query results. I plan to use textboxes to hold the
query view data results.

The question is how to move data from a query result in spreadsheet format
to a form and placing that data into a textbox.

I can link the blank record on the form to the query results but that only
shows me the current showing record in the result query. It does not allow
me to link row 2 to blank record 2 on the form or row 3 to blank record 3 on
the form.

I figure I will have to do all of this using a VB macro within access 2003
itself.

It's NOT THAT DIFFICULT.

Access has tools built in to accomplish your goal. You don't need to reinvent
them!

Create a Form based on your Patient table.
On it put a Subform based on your Medications table.
Enter your data.

No code, no special textboxes, no migration of data is needed.

John W. Vinson [MVP]
 
Carl:

Thanks much. The continious view worked just fine. I have been banging my
head against the wall for 2 weeks on this one. I am really good with Excel
and its internal VB but just getting into Access direct as it seems to have
more power for less work.

Bill
 
Back
Top