Is there an example of an access macro that will ask for an input.

T

tlg1261

Is there an example, or does anyone have, an access macro (for Forms) that
will ask for an input number and then add 1 to each additional record.
I am just a novice at this and I can't seem to get a macro to work.
Thanks for any help
 
S

Steve Schapel

Tlg1261,

When do you want this to happen? Do you mean when you add a new record?
There is an InputBox function that will prompt for a value... this may
serve your purposes. Also, have a look at the AutoNumber data type. If
I am on the wrong track, please post back with more details, with
examples, of what you want to do.
 
T

tlg1261

I am creating a database of unique cards these cards are barcoded and run in
sequence for approximately every 1000 cards. I need to be able to tell access
when i start adding a new record what the first number is in the sequence of
barcodes and have it automatically add one to this field until the sequence
is complete. When I start a new sequence I need to start the same process
over again for about 200,000 records. the format of the number is first
character alpha followed by 6 numbers (A111111)
 
S

Steve Schapel

Tlg1261,

Thanks for the further explanation.

First of all, the alpha prefix and the number portion of the barcode
need to be in separate fields in your table. Then, does each Series
have some sort of identifier, a series code or some such? If not, you
should arbitrarily assign one, and put a field for this also in the
cards table. It will make things easier if you have a Series table,
where you list all the series. If the SeriesID is meaningless, you can
use an AutoNumber.

Then, I would set it up this way... Put your form for entry of these
Cards records as a subform onto a form based on the Series table, with
the SeriesID as the Link Master Fields / Link Child Fields properties.
For the first Card in each Series, you can simply manually enter the
starting number. Then, you can assign a macro on the Before Insert
event of the Cards form, using a SetValue action, to set the value of
the barcode number field to the equivalent of...
DMax("[BarcodeNumberField]","CardsTable","[SeriesID]=" & [SeriesID])+1
 

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