simple problem i hope, please help

matnhouse

New member
Local time
Today, 09:24
Joined
Apr 21, 2006
Messages
6
:eek:

--------------------------------------------------------------------------------

I have made a reasonably simple database, for some reason I am struggling to send of reports by Emails.

The piece of code I am using is:

Private Sub cmdEMailRptPastNonCon_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "frmSwitchboard", acNormal

On Error GoTo Err_cmdEMailRptPastNonCon_Click
Dim stDocName As String

stDocName = "rptPastNonCon"
DoCmd.SendObject acReport, stDocName

Exit_cmdEMailRptPastNonCon_Click:
Exit Sub

Err_cmdEMailRptPastNonCon_Click:
MsgBox Err.Description
Resume Exit_cmdEMailRptPastNonCon_Click
End Sub


A box appears with the options [rich text,html,snapshot etc] I choose an option and a message box appears saying: "The database engine could not lock "tblMain" because it is already in use by another person or process., I know this is probably a simple stupid error ive made but being a complete beginner I am stuck, any ideas of where I should look to find any errors?

Thanks for any help recieved.

Mat
 
Did you do a search on "Email"? Emailing from Access is a common problem on the forum and your answer is quite likely there.
 
I believe the error message that you got is nothing to do with emailing.
When one of the users of my access application got this error, I found that the user do not have "Write" permission to the folder in which my mde/mdb file exists. If you dont have "Write" permission then access cannot create the *.ldb file which is lock file.
 
This common problem occurs when you have a form that opens a table directly and then tries to open the table AGAIN through underlying code on a separate recordset from the form's recordset. The form's record locking parameters are probably set wrong. You are blocking yourself by having two paths to the same table. (One via form, other via code/recordset.) Often you can fix this by selecting the form to lock only the edited record.

HOWEVER, if you are using code and a recordset to update the record that the form also has open, you have a more difficult problem. There, you must use code to make your change through the form itself.

If another record than the currently open one is in the hidden recordset, you might be able to do that (but if it is in the same vicinity in the file, the BUFFER is also locked and can cause you further headaches.)
 

Users who are viewing this thread

Back
Top Bottom