Pulling specified row from table into report text box

Bradon

Board Regular
Joined
Dec 18, 2002
Messages
66
I've struggled and failed to get a specified row from a table to print in a report.

I have a table containing memo fields that are to be used in 6 different reports (report1, report2 etc) i.e. tblinfo field: description and there are 6 rows containing data specific to each report.

How can I pull, for example, tblinfo[description]row1 (or2,3,4,5,6) so that it appears every time the report is used?
:oops:
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
If your tblInfo table has an ID field (with the values 1-6), you can use DLOOKUP to grab the appropriate value. Alternatively you could use a combo box to display the correct one, based on a query. In this scenario you could have a ReportName field, matching the appropriate memo to the current report.

Fairly general answer I know, but we need a bit more info (do you have an ID field as above, or do the reports have names that could easily be inserted into a field?). I'd go for the ID approach because it's more flexible, especially if you increase the number of reports and / or need to use the same memo text in more than one report.

Denis
 
Upvote 0
Thanks for your interest.

Yes there is an autonumber primary field (1-6).

I have tried using a combobox on the form with the default set to the appropriate row number and this works fine on records where all data is entered on the form. The snag comes when I import a volume of records and pull up the form, go to the report and the combo box hasn't updated to the default - it sits there waiting for me to select it.
 
Upvote 0
Hi Bradon,

yes, combos do that sometimes! You could try a texbox instead. Have a look at the DLOOKUP function -- it'll let you pull any individual field value in, based on a criterion -- use the ID to do that. I use it fairly infrequently so I don't have the syntax down pat, but the online help is useful.

Denis
 
Upvote 0
Hi Denis,

Thanks for a very simple answer to a sore head problem - it worked a treat.
Now I just have that time consuming problem of making all the changes.

Thanks again

Gordon
 
Upvote 0

Forum statistics

Threads
1,221,631
Messages
6,160,942
Members
451,679
Latest member
BlueH1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top