I'm writing a program that uses an access backend. what i'm wondering if there is a way to kill the ldb file. I have the mdb file disguised as a .dll but when the program opens the ldb file shows. Is there a way to stop this?
Printable View
I'm writing a program that uses an access backend. what i'm wondering if there is a way to kill the ldb file. I have the mdb file disguised as a .dll but when the program opens the ldb file shows. Is there a way to stop this?
No!!!
My guess is your using Access as a FrontEnd to the BackEnd MDB file.
Create a VB(6) FrontEnd - that way you wont get a LockFile.
bruce can you elaborate? I'm using vb as a "frontend"...or at least i thought i was
Maybe you are opening the MDB with some multiple use option.
This is what I am using (no LockFile):
VB Code:
Option Explicit 'Reference: M$ ActiveX Data Objects 2.X Library Private Sub Form_Load() Dim strSQL As String Dim rst As ADODB.Recordset Dim cnn As ADODB.Connection On Error GoTo Err_Handler Set rst = New ADODB.Recordset Set cnn = New ADODB.Connection strSQL = "SELECT [LastName] FROM [tblCustomers]" cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Customers.mdb;Persist Security Info=False;" rst.CursorLocation = adUseClient 'Set to enable Cursor movement rst.Open strSQL, cnn, adOpenForwardOnly, adLockOptimistic 'Check RS for data If Not rst.BOF And Not rst.EOF Then rst.MoveFirst 'Load the ListBox with the Last names Do Until rst.EOF List1.AddItem rst.Fields("LastName").Value rst.MoveNext Loop End If rst.Close cnn.Close Set rst = Nothing Set cnn = Nothing Exit Sub Err_Handler: If Not (rst Is Nothing) Then If rst.State = adStateOpen Then rst.Close Set rst = Nothing End If End If If Not (cnn Is Nothing) Then If cnn.State = adStateOpen Then cnn.Close Set cnn = Nothing End If End If MsgBox "Description: " & Err.Description & vbCrLf & _ "Number: " & Err.Number, vbOKOnly + vbInformation, "Error - Called from " & Me.Name & " Sub Form_Load" End Sub
VB Code:
Dim sfile As String sfile = App.Path & "\messages.mdb" Set db = OpenDatabase(sfile) With db Set rstComm = .OpenRecordset("select * from [message] where [Type] = 'Internet'") With rstComm .MoveFirst Do While Not .EOF List1.AddItem .Fields("name") .MoveNext DoEvents Loop End With End With
that is mine