Hi All, <o></o>
<o> </o>
I’m having a bit of an issue with record locking and I really can’t work out what the problem is…<o></o>
I’ve created a split database, record locks are set to no locks, and default open mode set to shared. It’s built in ms access 2007, and until now its gone pretty swimmingly… it’s not the first db I’ve created, but I would not consider myself expert by any means…<o></o>
<o> </o>
The bit that seems to be causing an issue is exporting… it doesn’t seem to matter whether I export via vba or the inbuilt exportwithformatting macro, but the db is locking/connecting to the relevant tables in the backend and not releasing when the report is then closed… and this is happening constantly for exporting to excel and pdf on all of the reports. <o></o>
When I open the report itself, then close without exporting the connection to the back end closes correctly, yet when the same report is exported, the connection remains, which if enough exports are done will then produces the ‘can’t open any more databases’ error message…<o></o>.<o></o>
I’ve tried decompiling /compiling/creating a new db/ using snapshot queries/ creating very simple reports with no filters and little formatting/ removing the errorhanding in the vba/ trying different methods for exporting(macro and vba) but nothing seems to cure the issue, and i cant work out how to end these bogus connections manually without shutting and reopening the db.
At this point I’m tearing my hair out… (this code works correctly in other dbs I’ve produced!!!)
this is one of the codes i've tried if that helps any...
Button click to call PDF procedure….</SPAN>
but as i said it doesnt matter how complicated or basic the query for the report, or if i use vba or built in macros.....
Any thoughts or ideas to try would be greatly appreciated!!!!
Regards
Brujah[/FONT]
<o> </o>
I’m having a bit of an issue with record locking and I really can’t work out what the problem is…<o></o>
I’ve created a split database, record locks are set to no locks, and default open mode set to shared. It’s built in ms access 2007, and until now its gone pretty swimmingly… it’s not the first db I’ve created, but I would not consider myself expert by any means…<o></o>
<o> </o>
The bit that seems to be causing an issue is exporting… it doesn’t seem to matter whether I export via vba or the inbuilt exportwithformatting macro, but the db is locking/connecting to the relevant tables in the backend and not releasing when the report is then closed… and this is happening constantly for exporting to excel and pdf on all of the reports. <o></o>
When I open the report itself, then close without exporting the connection to the back end closes correctly, yet when the same report is exported, the connection remains, which if enough exports are done will then produces the ‘can’t open any more databases’ error message…<o></o>.<o></o>
I’ve tried decompiling /compiling/creating a new db/ using snapshot queries/ creating very simple reports with no filters and little formatting/ removing the errorhanding in the vba/ trying different methods for exporting(macro and vba) but nothing seems to cure the issue, and i cant work out how to end these bogus connections manually without shutting and reopening the db.
At this point I’m tearing my hair out… (this code works correctly in other dbs I’ve produced!!!)
this is one of the codes i've tried if that helps any...
Button click to call PDF procedure….</SPAN>
Code:
Private Sub cmdPDF2_Click()</SPAN>
Dim myPath As String, strReportName1 As String, strReportName2 As String, strReportName3 As String</SPAN>
10 If gcfHandleErrors Then On Error GoTo PROC_ERR</SPAN>
20 PushCallStack "rep900AIRTRoles.cmdPDF2_Click"</SPAN>
30 strReportName1 = "Resourcing - " & Me.LabelHeader2.Caption & " - " & Format(Date, "dd mm yyyy") ’ main title for pdf</SPAN></SPAN>
35 strReportName1 = Replace(strReportName1, ":", "") ‘ get rid of illegal characters</SPAN></SPAN>
40 strReportName2 = "" ’</SPAN> extra space incase needed for future addition to title</SPAN></SPAN>
50 strReportName3 = ".pdf" ‘format required</SPAN></SPAN>
60 myPath = "\04 Resourcing Reports\01 Teams\04 Roles\" ' Exact folder to save PDF in</SPAN></SPAN>
70 strMyPath = GetPath() & myPath & strReportName1 & strReportName2 & strReportName3 ’ full save to file path</SPAN></SPAN>
80 strRepName = Me.Name ‘ Report name</SPAN></SPAN>
85 strOpenArgs = Me.OpenArgs ’Report filter</SPAN></SPAN>
90 Create_PDF2</SPAN>
95 MsgBox "The report you requested has been saved in the '" & GetPath() & myPath & "' folder.", vbInformation</SPAN>
PROC_EXIT:</SPAN>
PopCallStack</SPAN>
100 myPath = Empty: strMyPath = Empty: strReportName1 = Empty: strReportName2 = Empty: strReportName3 = Empty: strRepName = Empty</SPAN>
Exit Sub</SPAN>
Code:
Sub Create_PDF2()</SPAN>
10 If gcfHandleErrors Then On Error GoTo PROC_ERR</SPAN>
20 PushCallStack "Create_PDF"</SPAN>
30 DoCmd.OpenReport strRepName, acViewReport, , , , strOpenArgs</SPAN>
40 DoCmd.OutputTo acOutputReport, "", acFormatPDF, strMyPath, False, , , acExportQualityPrint</SPAN>
50 DoCmd.Close acReport, strRepName</SPAN>
PROC_EXIT:</SPAN>
PopCallStack</SPAN>
strRepName = Empty</SPAN>
strMyPath = Empty</SPAN>
strOpenArgs = Empty</SPAN>
Exit Sub</SPAN>
PROC_ERR:</SPAN>
GlobalErrHandler</SPAN>
Resume PROC_EXIT</SPAN>
End Sub</SPAN>
[FONT=Calibri]
but as i said it doesnt matter how complicated or basic the query for the report, or if i use vba or built in macros.....
Any thoughts or ideas to try would be greatly appreciated!!!!
Regards
Brujah[/FONT]