Email merge error - 3048

%3CLINGO-SUB%20id%3D%22lingo-sub-3117968%22%20slang%3D%22en-US%22%3EEmail%20merge%20error%20-%203048%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3117968%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESome%20code%20was%20written%20in%20the%20past%20that%20worked%20fine%20until%20this%20last%20week%20or%20so%20then%20we%20get%20error%203048.%26nbsp%3B%20As%20per%20a%20lot%20of%20suggestions%20on%20this%20forum%20we%20have%20made%20the%20location%20of%20both%20the%20client%20end%20database%20and%20the%20root%20database%20on%20the%20network%20trusted%2C%20but%20still%20get%20this%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20the%20code%20is%20a%20few%20years%20old%20I%20thought%20I%20would%20post%20to%20see%20if%20anyone%20knows%20of%20improvements%20we%20could%20make%20to%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20is%20to%20send%20statements%20to%20different%20contacts%2C%20here%20is%20the%20code%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPrivate%20Sub%20Command62_Click()%3C%2FP%3E%3CP%3EDim%20rst%20As%20DAO.Recordset%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESet%20rst%20%3D%20CurrentDb.OpenRecordset(%22qry_mass_emails%22)%3C%2FP%3E%3CP%3EDo%20Until%20rst.EOF%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Me.unit_sales_unit_no_sel.value%20%3D%20rst(%22unit_no%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20If%20DCount(%22id%22%2C%20%22tbl_trans%22%2C%20%22unit_no%3D%22%20%26amp%3B%20Me.unit_sales_unit_no_sel.value%20%26amp%3B%20%22%20AND%20flag%3DFalse%20AND%20contra%3DFalse%22)%20%26gt%3B%200%20Then%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Call%20sndrpt_unit_sales2%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Else%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Call%20sndrpt_unit_sales3%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20'DoCmd.SendObject%20%2C%20%2C%20%2C%20DLookup(%22email%22%2C%20%22tbl_tenants%22%2C%20%22id%3D%22%20%26amp%3B%20DLookup(%22tenant%22%2C%20%22tbl_units%22%2C%20%22unit_no%3D%22%20%26amp%3B%20Me.unit_sales_unit_no_sel))%2C%20%2C%20%2C%20%22Sales%20Report%22%2C%20%22Sorry%2C%20you%20have%20no%20sales%20transactions%20to%20report%20on.%22%20%26amp%3B%20Chr(10)%20%26amp%3B%20Chr(10)%20%26amp%3B%20%22Regards%22%20%26amp%3B%20Chr(10)%20%26amp%3B%20%22Astra%20Antiques%22%2C%20False%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20End%20If%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20rst.MoveNext%3C%2FP%3E%3CP%3ELoop%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Erst.Close%3C%2FP%3E%3CP%3EDoCmd.Close%3C%2FP%3E%3CP%3EDoCmd.OpenForm%20%22frm_menu_reports%22%2C%20%2C%20%2C%20stLinkCriteria%3C%2FP%3E%3CP%3EMsgBox%20%22Mass%20E-Mails%20Sent%22%3C%2FP%3E%3CP%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20suggestions.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKatherine%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3117968%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%202016%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAccess%20vba%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

Hi,

 

Some code was written in the past that worked fine until this last week or so then we get error 3048.  As per a lot of suggestions on this forum we have made the location of both the client end database and the root database on the network trusted, but still get this error.

 

As the code is a few years old I thought I would post to see if anyone knows of improvements we could make to it.

 

It is to send statements to different contacts, here is the code:

 

Private Sub Command62_Click()

Dim rst As DAO.Recordset

 

Set rst = CurrentDb.OpenRecordset("qry_mass_emails")

Do Until rst.EOF

    Me.unit_sales_unit_no_sel.value = rst("unit_no")

    If DCount("id", "tbl_trans", "unit_no=" & Me.unit_sales_unit_no_sel.value & " AND flag=False AND contra=False") > 0 Then

        Call sndrpt_unit_sales2

    Else

        Call sndrpt_unit_sales3

        'DoCmd.SendObject , , , DLookup("email", "tbl_tenants", "id=" & DLookup("tenant", "tbl_units", "unit_no=" & Me.unit_sales_unit_no_sel)), , , "Sales Report", "Sorry, you have no sales transactions to report on." & Chr(10) & Chr(10) & "Regards" & Chr(10) & "Astra Antiques", False

    End If

 

  rst.MoveNext

Loop

 

rst.Close

DoCmd.Close

DoCmd.OpenForm "frm_menu_reports", , , stLinkCriteria

MsgBox "Mass E-Mails Sent"

End Sub

 

 

Thanks for your suggestions.

 

Katherine

1 Reply
Some of my clients got the error and adding Trusted Locations for their FE & BE solved the problem of both the 3048 error and the .laccdb lock file not getting deleted. I didn't get the 3048 error until last night.
My installed version is:
Version 2201 (Build 14827.20198 Click-to-Run); 32-bit version of MS Office Professional Plus 2016

So looks like they fixed some and broke others.

For anyone interested, here's a quick way to see if you have the bug:

1. Create a new accdb
2. Create a table (Dual for me) with 1 Autonumber field.
3. Add one record
4. Insert a new module
5. Copy and paste the following code that creates a short recursive routine:


Option Compare Database
Option Explicit

Public Sub BugTest(Optional DbCount As Long = 1)
On Error GoTo errHandler
Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("Select * from Dual", dbOpenDynaset)
Debug.Print "Open Db count: " & DbCount
If DbCount < 1000 Then BugTest DbCount + 1

ExitSub:
If Not rs Is Nothing Then rs.Close
Set rs = Nothing
Exit Sub
errHandler:
Debug.Print Err.Number, Err.Description
Stop
Resume
GoTo ExitSub
End Sub

6. run BugTest procedure.

For me, the routine stops with the 3048 -Cannot open any more databases. after opening 252 (errors opening the 253rd recordset)