 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 17th, 2003, 01:03 PM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Report generation question
Hi everyone,
I have a few questions regarding Access and its report generation facilities. I have not used it in a long time and am very rusty.
- First, how can I get just the column names of a table in Access. Is it possible to do it through some VBA code in Access, for example.
- Second, how can I set the value of a Text box to a particular column entry in the database. I tried using the ControlSource property, but it did not work. I have a table called HeaderInfo with a column called HeaderString (a memo field) and I want to take this value and put it in the text box in ym report's header.
If someone can help me, I would be really grateful.
Thanks,
Sincerely,
Pankaj
|
|

December 17th, 2003, 01:09 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm not certain I understand what you are trying to do, but if you go to the following URL, under my name you can download a utility called AnalyzeTables2K.mdb. This will allow you to document all tables with their fields, data type and sizes.
http://www.rogersaccesslibrary.com/O...p#Moffitt,Beth
HTH,
Beth M
|
|

December 19th, 2003, 01:50 AM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by pankaj_daga
Hi everyone,
I have a few questions regarding Access and its report generation facilities. I have not used it in a long time and am very rusty.
- First, how can I get just the column names of a table in Access. Is it possible to do it through some VBA code in Access, for example.
I'm not exactly sure what you are asking here, but I will give it my best shot. In Report Design View, you could use the Tools Menu, and create a Label. If I had more info I could probably help you more. I've been using Access for many years.
- Second, how can I set the value of a Text box to a particular column entry in the database. I tried using the ControlSource property, but it did not work. I have a table called HeaderInfo with a column called HeaderString (a memo field) and I want to take this value and put it in the text box in ym report's header.
You could I believe use the Fields Menu, and drag and drop the field/column into the report header where you want it, then delete the Label, leaving just the field/column information.
If someone can help me, I would be really grateful.
Thanks,
Sincerely,
Pankaj
|
Robert J. Taylor
|
|

December 21st, 2003, 05:39 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Was that post really needed Robert?
I am a loud man with a very large hat. This means I am in charge
|
|

December 21st, 2003, 06:14 AM
|
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Dim x as integer
For x = 0 to CurrentDb.TableDefs!HeaderInfo.Fields.Count - 1
Debug.Print CurrentDb.TableDefs!HeaderInfo.Fields(x).Name
Next x
I hope this helps you.
|
|

December 21st, 2003, 06:23 AM
|
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
For the second part of the question:
1st set the RecordSource of the Report to the "HeaderInfo" Table
2nd set the ControlSource of the TextBox to the column you want
The above method is used for a general approach to bind controls in a report. I think that you have to apply a more specific method.
To use the memo field as a header in a report you have to display only one value from the whole table. So you have to filter the table with criteria to get a specific record and then access the memo field within the record. After you accomplish this you will populate the textbox dynamically using a procedure in the On_Open event of the report. There maybe some other methods but this is the one I have in mind:)
I think that you have to give me some more information so that I can help you! (e.g Criteria)
|
|
 |