integrating module with report

  • Thread starter Thread starter briank
  • Start date Start date
B

briank

Earlier I asked if it was possible to convert a number
into a text. Luckily I was pointed to a web site at
http://www.mvps.org/access/modules/mdl0001.htm that
showed me exactly what I needed. The problem is that I
have no idea of how to integrate this module into a
report where the number is located. Can anyone point me
to a site that explains this in a easy to use format?
 
1. Select the Modules tab of the Database window, and click New.
Access opens a new module window.

2. Copy the function, and paste into your module, i.e. everything between
these lines:
'************ Code Start **********
'************ Code End **********

3. Choose Compile from the Debug menu, to ensure that Access understands the
code. Save. The name "Module1" will do.

4. Open your report in design view.

5. Add a text box where you want the words to show. Set this as its
ControlSource:
=English([Amount])
replacing "Amount" with the name of your field.
 
You paste the code from the site into a new, blank module and save the
module as "basConversions". You can then add a text box in a report and set
the control source to
=English([YourField])
 
briank said:
Earlier I asked if it was possible to convert a number
into a text. Luckily I was pointed to a web site at
http://www.mvps.org/access/modules/mdl0001.htm that
showed me exactly what I needed. The problem is that I
have no idea of how to integrate this module into a
report where the number is located. Can anyone point me
to a site that explains this in a easy to use format?

The number is not "in the report" -- the number is in a table, and the
report prints the data from that table by running a query against it.
You can use the function in the query to transform the number before the
report ever sees it, or you can use the function in the Control Source
of a text box on the report to convert the number to words.

The first thing you have to do is copy and paste the code from the web
site into a standard module -- that is, one of the modules listed on the
Modules tab in the database window (and not a class module). If you
don't have an existing module where you might put it, create a new one,
then paste in the code (there are actually two function there, one of
which is a helper to the other) and save the module. The module must
have a name that is not the name of any procedure it contains. There's
nothing really wrong with "Module1" as a name for the module, though I
usually create a module named "basUtilities" to hold utility routines of
this sort.

Now, on your report, if you have a text box that is currently bound the
field in question -- let's call it "MyNumber" for the sake of this
example -- you can take that text box and modify its properties as
follows:

Name
------
If the text box currently has the same name as the field,
you must change the name to something else. If the
field is called "MyNumber", I suggest you change the
name of the text box to "txtMyNumberWords".

Control Source
---------------
Currently, the Control Source property is the
name of the field, "MyNumber". Change that
to

=English([MyNumber])

Width
 
Back
Top