I am trying to update a database for non-profit organization. Their membership numbers are a combination of the first letter of the surname plus an incremented number (i.e. L345). Currently, the users figure out the new number manually. I need help automating the new number on a new member form.
I have never done VBA coding, and this has become a nightmare of me:banghead:.
I thought I could find the first letter of the surname in the form on a before change by doing a Left([LastName], 1) on the form and then doing the same thing on the MemID field in tblMembers. What I can't seem to figure out is how to then combine the first letter result with the rest of the string and find the max number in the existing MemID with that particular letter to increment it for the new ID. Do I use a DMax statement? I tried setting up a Do Until Loop, but I got hopelessly lost. I don't think I'm stupid, but I am beginning to have my doubts.
If anybody can point me in the right direction I would really appreciate it. I don't necessarily want somebody to write the code, just point me in the right direction so I can try something else. My head is getting sore. Nothing like starting VBA with a complex question!
I have never done VBA coding, and this has become a nightmare of me:banghead:.
I thought I could find the first letter of the surname in the form on a before change by doing a Left([LastName], 1) on the form and then doing the same thing on the MemID field in tblMembers. What I can't seem to figure out is how to then combine the first letter result with the rest of the string and find the max number in the existing MemID with that particular letter to increment it for the new ID. Do I use a DMax statement? I tried setting up a Do Until Loop, but I got hopelessly lost. I don't think I'm stupid, but I am beginning to have my doubts.
If anybody can point me in the right direction I would really appreciate it. I don't necessarily want somebody to write the code, just point me in the right direction so I can try something else. My head is getting sore. Nothing like starting VBA with a complex question!