Steve R.
07-13-2011, 02:45 PM
I have a split Access 2007 database. I am adding the ability for each person to print their own mailing list. The mailing list data itself is on the back-end. However, there also has to be a table on the local drive so that persons A's mailing list selections do interfere with person B's selections.
Below is the current code when opening the mailing list selection form. The subform datasheet has a check box for each name to determine who gets mailed a letter. Code works just fine.
My question, does this approach seem to be the best way to handle the situation; or are there other more efficient ways to do this? Do I really need to delete/create a table on the local drive or is there a way to do it from the back-end?
Additionally, I am contemplating how to update the local table, if there are changes to the back-end table. It may not even be necessary or may be overkill, since a new table is created every time this program is entered.
Rem Create Local Table for mail merge
strDestinationTableName = "tblLocalMailMerge"
strSourceTableName = "MailMergeMainQuery"
If TableExists(strDestinationTableName) Then
Rem Delete Table
CurrentDb.Execute "DROP TABLE " & strDestinationTableName & ";"
End If
If Not TableExists(strDestinationTableName) Then
Rem Create New Table
CurrentDb.Execute "Select MMIDNUM,MergeFlag,First,Last,DivisioNname,Section0 1,MMAddress1,MMAddress2,MMCity,MMState,MMZipCode INTO " & strDestinationTableName & " FROM " & strSourceTableName & ";"
End If
Rem ------------------------------------------------------------
Me.Child0.Form.RecordSource = "SELECT * FROM " & strDestinationTableName & ";"
Below is the current code when opening the mailing list selection form. The subform datasheet has a check box for each name to determine who gets mailed a letter. Code works just fine.
My question, does this approach seem to be the best way to handle the situation; or are there other more efficient ways to do this? Do I really need to delete/create a table on the local drive or is there a way to do it from the back-end?
Additionally, I am contemplating how to update the local table, if there are changes to the back-end table. It may not even be necessary or may be overkill, since a new table is created every time this program is entered.
Rem Create Local Table for mail merge
strDestinationTableName = "tblLocalMailMerge"
strSourceTableName = "MailMergeMainQuery"
If TableExists(strDestinationTableName) Then
Rem Delete Table
CurrentDb.Execute "DROP TABLE " & strDestinationTableName & ";"
End If
If Not TableExists(strDestinationTableName) Then
Rem Create New Table
CurrentDb.Execute "Select MMIDNUM,MergeFlag,First,Last,DivisioNname,Section0 1,MMAddress1,MMAddress2,MMCity,MMState,MMZipCode INTO " & strDestinationTableName & " FROM " & strSourceTableName & ";"
End If
Rem ------------------------------------------------------------
Me.Child0.Form.RecordSource = "SELECT * FROM " & strDestinationTableName & ";"