psquillace said:
Thanks Dirk for all your help with this.
The # is already set to Currency, I tried setting it to fixed but
with no results. If I set it to 0 decimal places it seems to work but
that is not the result I am looking for.
Are you sure you set the Format property, on the property sheet of the
text box in the design view of the form? We're not concerned with the
field type of the field in the table. With the text box's Format
property set to "Currency" and its Decimal Places property set to 2, you
should always get two decimal places displayed on the form.
As far as the printing thing,
I have this code in there -
stDocName = "Form1"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
so I should change the line DoCmd.PrintOut to DoCmd.Print,,,,2?
That looks like a bit of a mish-mosh. Let's assume that you want to
print the currently active form. That would be the case if you're
triggering this from a command button on the form. Then all you'd need
is the one line
DoCmd.PrintOut , , , , 2
or, using an alternate syntax to avoid all those confusing commas,
DoCmd.PrintOut Copies:=2
Note that this is going to print out *all* records currently in the
form's recordset. So if the form currently displays multiple records,
and you want to print just the current one, and you really want to print
the form, not a report that is similar to the form, then your code will
need to filter the form before calling DoCmd.PrintOut, and maybe
"unfilter it" afterward. And then you'll probably want to get back to
the record you were on, since removing the filter will reposition the
form to the first record in its recordsource. All this makes your code
more complicated:
'----- start of example code -----
Dim varID As Variant
' Make sure the current record has been saved.
If Me.Dirty Then Me.Dirty = False
' Remember which record we're currently on.
' [ID] is the primary key of this form's recordsource.
varID = Me.ID
' Filter the form for just that record.
Me.Filter = "ID=" & varID
Me.FilterOn = True
' Print out the form.
DoCmd.PrintOut Copies:=2
' Remove the filter.
Me.FilterOn = False
' Reposition the form to the record we were on.
Me.Recordset.FindFirst "ID=" & varID
'----- end of example code -----
Printing out a report would be simpler.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)