Populate a Field

E

Eric Starn

I am looking for some suggestions on how to populate a field. I created a
text field, [Asset ID], which will just be a random four digit number. This
field will be used to identify the asset for its lifespan in the database. I
also created a form so that all the asset info can be input by the user. I
would like the [Asset ID] field to automatically populate in the form with a
new number every time a user inputs a new asset. I have tried to use the
auto-number option, however I am also using the [Asset ID] field in a
one-to-many relationship with other tables and this seems to make everything
go crazy.

So I am looking for any help and ideas I can get.

Eric
 
A

Armen Stein

I am looking for some suggestions on how to populate a field. I created a
text field, [Asset ID], which will just be a random four digit number. This
field will be used to identify the asset for its lifespan in the database. I
also created a form so that all the asset info can be input by the user. I
would like the [Asset ID] field to automatically populate in the form with a
new number every time a user inputs a new asset. I have tried to use the
auto-number option, however I am also using the [Asset ID] field in a
one-to-many relationship with other tables and this seems to make everything
go crazy.

Hi Eric,

I don't see any reason not to use an AutoNumber. It will be the
primary key in your Asset table. The related tables with "many"
records will also have AssetID as a field, defined as Numeric - Long
Integer. You would need to be more specific about "everything going
crazy". :)

Be aware that with AutoNumber you'll have to choose sequential number
or random. Random will have positive and negative numbers much larger
than 4 digits. I don't recommend Random for your situation.
Sequential will have gaps in the sequence sometimes, so you shouldn't
care too much about what each actual value is.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
E

Eric Starn

Thanks for the help.

Right now in my Asset table the [Asset ID] is a text field. So if I
understand correctly keep it a text field in the Asset table but change the
the [Asset ID] in the other table to a Numeric - Long Integer and it should
work?

Eric

Armen Stein said:
I am looking for some suggestions on how to populate a field. I created a
text field, [Asset ID], which will just be a random four digit number. This
field will be used to identify the asset for its lifespan in the database. I
also created a form so that all the asset info can be input by the user. I
would like the [Asset ID] field to automatically populate in the form with a
new number every time a user inputs a new asset. I have tried to use the
auto-number option, however I am also using the [Asset ID] field in a
one-to-many relationship with other tables and this seems to make everything
go crazy.

Hi Eric,

I don't see any reason not to use an AutoNumber. It will be the
primary key in your Asset table. The related tables with "many"
records will also have AssetID as a field, defined as Numeric - Long
Integer. You would need to be more specific about "everything going
crazy". :)

Be aware that with AutoNumber you'll have to choose sequential number
or random. Random will have positive and negative numbers much larger
than 4 digits. I don't recommend Random for your situation.
Sequential will have gaps in the sequence sometimes, so you shouldn't
care too much about what each actual value is.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
A

Armen Stein

Thanks for the help.

Right now in my Asset table the [Asset ID] is a text field. So if I
understand correctly keep it a text field in the Asset table but change the
the [Asset ID] in the other table to a Numeric - Long Integer and it should
work?

No, if you want to use automatic numbering it needs to be an
AutoNumber in the Asset table and a Number - Long Integer in the
related tables.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 

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