Autofill and modify data in Access

M

Mary Hartman

I could do this if I were programming in basic, but I'm not sure it
can be done for Access. I have built a database driven website using
Access. Each item has a number of jpgs for display. The names of
these are built off the stock number. For example:

Stocknumber: 1234
1st Jpg: 1234.jpg
2nd jpg: 1234a.jpg
3rd jpg: 1234b.jpg
etc.

Is it possible to create a routine in Access that if the stock number
is entered "1234" it will automatically append the endings and then
fill in all the Picture_name_fields.

There are about 15,000 items that need to be put into the database,
some with as many as 6 pictures, so any automation would help a lot.
Of course I'd have to tell the database how many pictures that
particular item had first: only 1 or as many as 6.

I know this isn't an easy one. Thank you anyone who can help at all.
 
A

Arvin Meyer [MVP]

Program it in Basic and put it in a standard module in Access. Then call it
in a query or from a command button. Code in VBA is almost bit for bit the
same as code in Visual Basic (6.0 not .net) I haven't done exactly what you
want but here's something that is along a similar method.:

http://www.datastrat.com/Download/AlphaNumeric2K.zip
 
M

Mary Hartman

Okay, I'll try writing a basic routine and plugging it into maybe an
after-update section. Click on if there is a picture or not and if
yes than append "a.jpg" or "b.jpg" and fill the field.

I am not quite sure how to ID the correct Access field in basic.
Should I use form ID or Table ID?
 
A

Arvin Meyer [MVP]

You'd use the name of a control, like a textbox, or a command button, not a
field to run your code. I would look at the ANSI value, so for instance
lookup (or use a recordset, it's faster) the record for 1234c.jpg (i.e. that
last existing record for 1234). Then strip off the .jpg and parse the c to
find the next charcter to use. lower case c = Chr(99), so the next name
would be: "1234" & Chr(100) & ".jpg"
 

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