Re: Change field format programmatically
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Fri, 03 Feb 2006 16:26:37 -0600
In this case, things get kind of tricky.
Create a function in the form's module to format the value:
Private Function MyFormat(num, typ) As Variant
Select Case typ
Case "vertical"
MyFormat = Format(num, "@@@@@@ @ @ @@ @@")
Case "piping"
MyFormat = Format(num, "@@@@@@@@@@@ @ @@"
. . .
End Select
End Function
Create an text box to display the formatted value. Set its
control source expression to :
=MyFormat([item number], [item type])
and use its GotFocus event to immediately (re)set the focus
to the item number text box so the value can be edited.
Finally, size and position the display text box exactly on
top of the item number text box.
--
Marsh
MVP [MS Access]
wAyne wrote:
yeah, I thought of this -- but it is a continuous form -- is there asyway.
to do this for continuous forms?
wAyne wrote:
I have a table of items - where the item number display format is different
for based on item type.
e.g item type vertical item number ver-123 a b cc dd
item type piping itme number ver-4567890 a dd
Is ther a way I can alter the format so that when the record is dispayed it
display's the item number in the appropriate way?
"Marshall Barton" wrote:
If the form is displayed in Single View (not data*** or
continuous), then you can use the form's Current event to
set the item number text box's Format property as needed.
Then general idea is something like:
Select Case Me.ItemType
Case "vertical"
Me.txtItemNumber.Format = "@@@@@@ @ @ @@ @@"
Case "piping"
Me.txtItemNumber.Format = "@@@@@@@@@@@ @ @@"
Case
. . .
- Follow-Ups:
- Re: Change field format programmatically
- From: wAyne
- Re: Change field format programmatically
- References:
- Re: Change field format programmatically
- From: Marshall Barton
- Re: Change field format programmatically
- Prev by Date: Re: What's the name of a subform event?
- Next by Date: Re: Problem with Dialog
- Previous by thread: Re: Change field format programmatically
- Next by thread: Re: Change field format programmatically
- Index(es):