generate random number

K

Kirt84

I require a function where Access will generate an Autonumber with each
number beginning with the letters 'BNS'; I would like about 8 numbers after
this. Also the numbers have to be unique. I am still a novice in Access so if
someone can give me a step by step guide it would be great!
 
P

Pieter Wijnen

Control: DisplayNum ControlSource: ="BSN" & Format([IDField],"00000000")
Note you may have to use ';' instead of ',' dependant on the windows
regional setting
& swap [IDField] for the actual Field

Pieter
 
K

Kirt84

Pieter

I have created a table and set the IDFiled to Autonumber. Then I have
created an input Form and on the control source of the IDField I have put in
the expression:

DisplayNum ControlSource: ="BSN" & Format([IDField],"00000000")

I have probably done it wrong as i'm still new to Access......please help!!

Thank you


Pieter Wijnen said:
Control: DisplayNum ControlSource: ="BSN" & Format([IDField],"00000000")
Note you may have to use ';' instead of ',' dependant on the windows
regional setting
& swap [IDField] for the actual Field

Pieter

Kirt84 said:
Thanks, but how do I have the letters in front of the Autonumber???

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4382 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
 
P

Pieter Wijnen

use
="BSN" & Format([IDField],"00000000")

DisplayNum was my suggestion for the Control Name, Do Not use the same as
the Field Name, Access will Think you refer to the Control (ie self
reference)

Pieter

Kirt84 said:
Pieter

I have created a table and set the IDFiled to Autonumber. Then I have
created an input Form and on the control source of the IDField I have put
in
the expression:

DisplayNum ControlSource: ="BSN" & Format([IDField],"00000000")

I have probably done it wrong as i'm still new to Access......please
help!!

Thank you


Pieter Wijnen said:
Control: DisplayNum ControlSource: ="BSN" & Format([IDField],"00000000")
Note you may have to use ';' instead of ',' dependant on the windows
regional setting
& swap [IDField] for the actual Field

Pieter

Kirt84 said:
Thanks, but how do I have the letters in front of the Autonumber???
--
Thank you for your help


:

Kirt84 wrote:
I require a function where Access will generate an Autonumber with
each number beginning with the letters 'BNS'; I would like about 8
numbers after this. Also the numbers have to be unique. I am still a
novice in Access so if someone can give me a step by step guide it
would be great!

No what you want is a random number (autonumber will generate one)
and
then you want to DISPLAY that number with the letters "BNS" in front
of
it.
Don't bother trying to store the "BNS" in a table as there is no need
to.
There are several ways of displaying the BNS depending on where you
will
need it.

Note: the user should never see the table directly or enter or
edit
data
there. They should only see data in forms, reports and maybe queries.
Tables are only buckets of data and a list of field definitions.

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4382 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
 
K

Kirt84

This now works but how do I store the whole value in the table. At the moment
it just displays the one value - 1,2,3,4 etc
--
Thank you for your help


Pieter Wijnen said:
use
="BSN" & Format([IDField],"00000000")

DisplayNum was my suggestion for the Control Name, Do Not use the same as
the Field Name, Access will Think you refer to the Control (ie self
reference)

Pieter

Kirt84 said:
Pieter

I have created a table and set the IDFiled to Autonumber. Then I have
created an input Form and on the control source of the IDField I have put
in
the expression:

DisplayNum ControlSource: ="BSN" & Format([IDField],"00000000")

I have probably done it wrong as i'm still new to Access......please
help!!

Thank you


Pieter Wijnen said:
Control: DisplayNum ControlSource: ="BSN" & Format([IDField],"00000000")
Note you may have to use ';' instead of ',' dependant on the windows
regional setting
& swap [IDField] for the actual Field

Pieter

Thanks, but how do I have the letters in front of the Autonumber???
--
Thank you for your help


:

Kirt84 wrote:
I require a function where Access will generate an Autonumber with
each number beginning with the letters 'BNS'; I would like about 8
numbers after this. Also the numbers have to be unique. I am still a
novice in Access so if someone can give me a step by step guide it
would be great!

No what you want is a random number (autonumber will generate one)
and
then you want to DISPLAY that number with the letters "BNS" in front
of
it.
Don't bother trying to store the "BNS" in a table as there is no need
to.
There are several ways of displaying the BNS depending on where you
will
need it.

Note: the user should never see the table directly or enter or
edit
data
there. They should only see data in forms, reports and maybe queries.
Tables are only buckets of data and a list of field definitions.

--
Joseph Meehan

Dia duit




--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4382 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4388 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
 
P

Pieter Wijnen

No need to!
Just use the formula whenever you present the data (Queries, Forms, Reports)

Pieter

Kirt84 said:
This now works but how do I store the whole value in the table. At the
moment
it just displays the one value - 1,2,3,4 etc
--
Thank you for your help


Pieter Wijnen said:
use
="BSN" & Format([IDField],"00000000")

DisplayNum was my suggestion for the Control Name, Do Not use the same as
the Field Name, Access will Think you refer to the Control (ie self
reference)

Pieter

Kirt84 said:
Pieter

I have created a table and set the IDFiled to Autonumber. Then I have
created an input Form and on the control source of the IDField I have
put
in
the expression:

DisplayNum ControlSource: ="BSN" & Format([IDField],"00000000")

I have probably done it wrong as i'm still new to Access......please
help!!

Thank you


:

Control: DisplayNum ControlSource: ="BSN" &
Format([IDField],"00000000")
Note you may have to use ';' instead of ',' dependant on the windows
regional setting
& swap [IDField] for the actual Field

Pieter

Thanks, but how do I have the letters in front of the Autonumber???
--
Thank you for your help


:

Kirt84 wrote:
I require a function where Access will generate an Autonumber
with
each number beginning with the letters 'BNS'; I would like about
8
numbers after this. Also the numbers have to be unique. I am
still a
novice in Access so if someone can give me a step by step guide
it
would be great!

No what you want is a random number (autonumber will generate
one)
and
then you want to DISPLAY that number with the letters "BNS" in
front
of
it.
Don't bother trying to store the "BNS" in a table as there is no
need
to.
There are several ways of displaying the BNS depending on where you
will
need it.

Note: the user should never see the table directly or enter or
edit
data
there. They should only see data in forms, reports and maybe
queries.
Tables are only buckets of data and a list of field definitions.

--
Joseph Meehan

Dia duit




--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4382 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4388 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
 
K

Kirt84

Hello Pieter

I put the formula in the IDField Control Source of my Report but it comes up
with an "error". Also where do I put the formula on the Query? Sorry to keep
asking questions but i'm still a novice at Access.
--
Thank you for your help


Pieter Wijnen said:
No need to!
Just use the formula whenever you present the data (Queries, Forms, Reports)

Pieter

Kirt84 said:
This now works but how do I store the whole value in the table. At the
moment
it just displays the one value - 1,2,3,4 etc
--
Thank you for your help


Pieter Wijnen said:
use
="BSN" & Format([IDField],"00000000")

DisplayNum was my suggestion for the Control Name, Do Not use the same as
the Field Name, Access will Think you refer to the Control (ie self
reference)

Pieter

Pieter

I have created a table and set the IDFiled to Autonumber. Then I have
created an input Form and on the control source of the IDField I have
put
in
the expression:

DisplayNum ControlSource: ="BSN" & Format([IDField],"00000000")

I have probably done it wrong as i'm still new to Access......please
help!!

Thank you


:

Control: DisplayNum ControlSource: ="BSN" &
Format([IDField],"00000000")
Note you may have to use ';' instead of ',' dependant on the windows
regional setting
& swap [IDField] for the actual Field

Pieter

Thanks, but how do I have the letters in front of the Autonumber???
--
Thank you for your help


:

Kirt84 wrote:
I require a function where Access will generate an Autonumber
with
each number beginning with the letters 'BNS'; I would like about
8
numbers after this. Also the numbers have to be unique. I am
still a
novice in Access so if someone can give me a step by step guide
it
would be great!

No what you want is a random number (autonumber will generate
one)
and
then you want to DISPLAY that number with the letters "BNS" in
front
of
it.
Don't bother trying to store the "BNS" in a table as there is no
need
to.
There are several ways of displaying the BNS depending on where you
will
need it.

Note: the user should never see the table directly or enter or
edit
data
there. They should only see data in forms, reports and maybe
queries.
Tables are only buckets of data and a list of field definitions.

--
Joseph Meehan

Dia duit




--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4382 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!




--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4388 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4450 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
 

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