Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting only one record from a table into report

Status
Not open for further replies.

malbreht

Technical User
Dec 8, 2006
63
SI
Hi,

I want to sell the DB to not just one company, but want to have the name and the adress in every report head customized. That's why I've got a form where the company will enter their data into a table tblCompany (Name, Adress,...)

However, if I insert the fields from that table into a report, on opening Access of course asks me, which company do I want to select (although there is and always will be just obe record in that table). I want Access to automatically select the one and only record from that table.

Has anybody ever had that kind of problem and how did you solve it?

Again, many thanks!
 
Where is this prompt? When running the report? (Then it would be a parameter prompt in a query, most likely).

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Well, yeah, when I try to open the report this window pops up and wants to know for which company do I want to select this report...

Quite annoying for the user, actually unacceptable :)
 
Look in the 'Record source' in the 'data' section of the properties for the report.

It's tough to sell a database you don't quite understand...
 
OK, firstly: I do understand my simple database quite good, it's just this thing that bothers me. Without custom report header everything works just fine.

But I want to make this database a little better, meaning that everyone could use it without any IT skills.

I suppose companies want their logo or at least the name of their company to be in the report header.

So, in the record source I wrote "=tblCompany!CompanyID", because I want the report to get the name of the company from the tblCompany. I just don't want Access to ask me which company, but it should by default select CompanyID=1.

Please help...any ideas?
 
OK, sorry, I have to use DLOOKUP function, I'm such a...

Control source is now =DLookUp("[COmpanyID]";"tblCompany";"[CompanyID] = 1")

And it works.
 
Sorry about the crack.

You could make the record source a query with a where clause like ...where CompanyID=1.
I do similar things to store default data for forms in a table and have a different query as the record source for each form.


Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top