Input Mask Question

M

marf

What is the best way to format a field in my ProjectsTable, the format for a
project# is 2008-001. I don't mind fixing the 2008, but I need to figure out
how to best configure the 001, which I would like to be autonumbered. I also
want to make sure the - (dash) is displayed in the forms and reports
 
W

Wayne-I-M

Hi

Not ure if you are looking for the number to be filled in auto - in this
case create an autonumber field in the table and in a query use something like

SomeName: Format(Date(),"yyyy") & " - " &
IIf([TableName]![AutoNumberField]<10,"00" &
[TableName]![AutoNumberField],IIf([TableName]![AutoNumberField]>9 And
[TableName]![AutoNumberField]<100,0 &
[TableName]![AutoNumberField],[TableName]![AutoNumberField]))

This assumes you are using the current year to give the first "bit" of the
string - oh as you will notice the vast majority of tis will become redundant
after the autonumber goes over 100 - in this case you could just use

SomeName: Format(Date(),"yyyy") & " - " & [TableName]![AutoNumberField]

If you are inputting the 2008 then just use (almost) the same as above but
alter it to use the name of the control you are putting the 2008 into instead
of the [TableName]![AutoNumberField]

=Format(Date(),"yyyy") & " - " &[ControlName]
 
M

marf

Thanks Wayne....
Perfect!

Wayne-I-M said:
Hi

Not ure if you are looking for the number to be filled in auto - in this
case create an autonumber field in the table and in a query use something like

SomeName: Format(Date(),"yyyy") & " - " &
IIf([TableName]![AutoNumberField]<10,"00" &
[TableName]![AutoNumberField],IIf([TableName]![AutoNumberField]>9 And
[TableName]![AutoNumberField]<100,0 &
[TableName]![AutoNumberField],[TableName]![AutoNumberField]))

This assumes you are using the current year to give the first "bit" of the
string - oh as you will notice the vast majority of tis will become redundant
after the autonumber goes over 100 - in this case you could just use

SomeName: Format(Date(),"yyyy") & " - " & [TableName]![AutoNumberField]

If you are inputting the 2008 then just use (almost) the same as above but
alter it to use the name of the control you are putting the 2008 into instead
of the [TableName]![AutoNumberField]

=Format(Date(),"yyyy") & " - " &[ControlName]

--
Wayne
Manchester, England.



marf said:
What is the best way to format a field in my ProjectsTable, the format for a
project# is 2008-001. I don't mind fixing the 2008, but I need to figure out
how to best configure the 001, which I would like to be autonumbered. I also
want to make sure the - (dash) is displayed in the forms and reports
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top