Moving data from a report to a form

K

Kodawari

Hello, I have a report which data gets generated by a Form Based Query. The
report kicks off the query upon loading.
The data contains many “short fields†with limited data except for two
fields that contain a free-form question and answer (which can be quite
long). Therefore, the report contains one line per record without the
questions and answer (otherwise the report would be huge).
I want to give the ability to open one entire record (which contains the
question and answer) by clicking the line in the report that is of interest.
So far, I have created a button next to each line in the report which will
open a form (via macro) that will contain the individual record data.
However, my problem lies in getting the Access “record number†from the
report over to the form (in a particular field) so that a form based macro
can open the record to be displayed. How can this be accomplished? There
are no queries on forms, right? I do not know VB so that is a handicap.
Please let me know if there are any creative ideas to solve my problem.
Thanks
 
K

Klatuu

There are no such things as presistent record numbers in Access. When you
see record numbers - in the navigation control, for example, what you are
seeing is a relative number based on the current recordset.

What you can do with a Macro is to use the Where Condition argument of an
OpenForm Action to cause the form to open up to the record you want.
 
K

Kodawari

Hello Dave. Thanks for your answer. An additional qestion; How can I
indicate in the "where" statement which record from the report it is (line
number, relative record number)? This will change based on what the report
contains (driven by the form based query) and which item the viewer selects.
Thanks,
Matthew
 
K

Klatuu

Each record in your table should have a primary key field. If you do not
have one, you can add a long integer field to your table and use an
autonumber to automatically create a unique value for each field.

You use that field in the Where argument. For example, let's say you have
primary key field named MyRecordID and it is a long interger field. The
expression in the Where argument would be:

MyRecordID = Me.txtRecordID

Where txtRecordID would be the control on the report bound to MyRecordID
 
K

Kodawari

Thanks for your help!!

Klatuu said:
Each record in your table should have a primary key field. If you do not
have one, you can add a long integer field to your table and use an
autonumber to automatically create a unique value for each field.

You use that field in the Where argument. For example, let's say you have
primary key field named MyRecordID and it is a long interger field. The
expression in the Where argument would be:

MyRecordID = Me.txtRecordID

Where txtRecordID would be the control on the report bound to MyRecordID
 

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