mercredi 25 mars 2015

VBA Access Adding Control Value into Dictionaries of Dictionaries

I have issues I have been dealing with for the past month with respect to a "simple" form that is meant to allow for addition of information, with a part of the information allowing for multiples of the same type


There are three sections within the form:



Info A:
Basic Organization Information
Info B:
Basic Organization Address Information
Info C:
Basic Organization Staff Information
Info C a: Basic Organization Staff Contact Information


I have an issue with implementing the ability for the user to add as many staff members as needed on button click. There is also a button that opens another form for the addition of as many phone numbers as needed for each staff member. Additionally there is a button to confirm the addition and close the form.


I had this set up with the use of temp tables, however, I ran into issues with @@Identity and problems with the ID's matching up correctly.


I am currently trying to use Dictionaries, in the following way:



OrganizationDictionary: Name, Type, Affiliation, Website ....
OrganizationAddressDictionary: Street, City, State, Zip, Phone, Fax

StaffDictionary
StaffMemberDictionary
StaffBioDictionary: Name, Position, Email ...
StaffAddressDictionary: Street, City, State, Zip
StaffPhoneBookDictionary
StaffPhoneDictionary: Type, Number


So essentially assuming that a user clicks to add additional phones, I run a function that inserts into StaffPhoneDictionary and adds it to the StaffPhoneBookDictionary. Then if a user wants to add additional staff on that button click I add the information into the respective dictionaries.


When a user then clicks on Confirm all the information gets saved into the dictionaries and moved onto the tables.....or so it should ideally.


Along this path, I've run into issues with the addition of multiple phones and the keys not updating, even though that Dictionary is local to a single function and I set it to Nothing after the function runs.


So in sum, basically wondering if anyone has suggestions as to a better way to approach creating a form that would allow for multiple additions of one stretch of information that within it allows for multiple additions of a stretch of information associated with it, that is all then associated with the information above it.


Also, while I would love the suggestion that said "Don't use Ms Access!" this is the only platform that I can work with on this particular project....


Aucun commentaire:

Enregistrer un commentaire