Subject: Report generation question
Posted By: pankaj_daga Post Date: 12/17/2003 12:03:17 PM
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



Reply By: BethMoffitt Reply Date: 12/17/2003 12:09:24 PM
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/OtherLibraries.asp#Moffitt,Beth

HTH,

Beth M
Reply By: MrSpock1956 Reply Date: 12/19/2003 12:50:26 AM
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
Reply By: Steven Reply Date: 12/21/2003 4:39:50 AM
Was that post really needed Robert?


I am a loud man with a very large hat. This means I am in charge
Reply By: edcaru Reply Date: 12/21/2003 5:14:24 AM
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.
Reply By: edcaru Reply Date: 12/21/2003 5:23:06 AM
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)

Go to topic 6076

Return to index page 982
Return to index page 981
Return to index page 980
Return to index page 979
Return to index page 978
Return to index page 977
Return to index page 976
Return to index page 975
Return to index page 974
Return to index page 973