Changing formatting

  • Thread starter Thread starter Cathy
  • Start date Start date
C

Cathy

Good afternoon all!

I'm hoping someone can help me out...

I have a subform that needs the numeric value format
changed from currency to standard based on the choices the
user makes on the main form. How do I go about doing this?

I've tried something like:

If [Forms]![Main]!CategoryID.Text = "Head Count" Then
Me.Amount1.Format = "Standard"
Else
Me.Amount1.Format = "Currency"
End If

No errors, but no changes either... What's the correct
syntax?

Thanks,
Cathy
 
Cathy said:
I have a subform that needs the numeric value format
changed from currency to standard based on the choices the
user makes on the main form. How do I go about doing this?

I've tried something like:

If [Forms]![Main]!CategoryID.Text = "Head Count" Then
Me.Amount1.Format = "Standard"
Else
Me.Amount1.Format = "Currency"
End If

No errors, but no changes either... What's the correct
syntax?


First problem, unlike VB, you almost never want to use a
text box's Text property. Use the Value property instead
and, since it's the default property, you don't event need
to specify it.

Next issue, I would expect the code to be in the main form,
not the subform. Can't tell from your question, but
generally, the code should be run from the form's Current
event and the CategoryID text box's AfterUpdate event.

Given all that, here's the code:

If Me.CategoryID = "Head Count" Then
Me.subform.Form.Amount1.Format = "Standard"
Else
Me.subform.Form.Amount1.Format = "Currency"
End If
 
Back
Top