Help writing a VBA module

M

Michael D.

Hello all!

I'm trying to design and write a little module (or macro even) for someone
in my office, but I'm having some trouble. I have the following database
structure (Note: just some sample data, obviously):

SystemNumber SystemNumberMAX SystemName SystemKey
9007404 Windows Test 1 A
9007405 Windows Test 1 A
9007406 Windows Test 1 A
9008683 Windows Test 45 A
9008684 Windows Test 45 A
9017616 Windows Test 4595bg A
9019528 Windows Test 1 B

The SystemNumberMAX field is to be populated with the maximum SystemNumber
for a group, where a group is a unique System Key and System Name combo. The
SystemNumberMAX is only to be filled when there is more than 1 System Number
for a group. Thus, when the module is complete, the above record set should
look like this:
SystemNumber SystemNumberMAX SystemName SystemKey
9007404 9007406 Windows Test 1 A
9008683 9008684 Windows Test 45 A
9017616 Windows Test 4595bg A
9019528 Windows Test 1 B


I'm totally stumped though! I've only done stuff like affecting forms and
switchboards in Access/VBA. I'm thinking the steps are:

1. Select the max SystemNumber # for the group and write it to a variable.
2. Delete the records in the range between the minimum and maximum
SystemNumber for the group (including the record for the max SystemNumber)
3. Write the max SystemNumber into the SystemNumberMAX field.

Can anyone offer guidance or example code for something similar?

Thanks! -Mike
 

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