[AccessD] Actually using the email

John Colby jwcolby at gmail.com
Sat Aug 21 09:26:39 CDT 2021


Sorry, I somehow managed to send that last email before it was finished.


It turns out you can ask a table if it has a field by something like

Dim strFldName as string
    StrFldName = rst.fields("SomeFieldName").Name

If the field exists, then strFldName will contain " SomeFieldName".  If the
field does not exist then the code will error.  If the code errors, then we
build the field.

Remember that I created a clsKeyVal which has the field name and value.
KeyVal pairs are common in programming.  So that class is:

Option Compare Database
Option Explicit

Public mKey As String
Public mVal As String

Using this simple class to hold the two pieces and strong these class
instances in a collection gives me the data required to automatically build
a table even if new fields are added, with no further effort on my part.
Once the table is built / new fields added, I also have the data to build a
new record with all the data from the email.

-- 
John W. Colby
Colby Consulting


More information about the AccessD mailing list