Run Time Error 3794

Ciaran

Registered User.
Local time
Today, 00:27
Joined
May 8, 2003
Messages
13
I'm getting a run time error saying that the database is locked by the Admin on my machine, which is me. How do I allow the current database be opened and updated?

Private Sub cmd_Execute_Click()

Dim dbs As DAO.Database
Dim Form_Number_Insert As String
Dim State_Insert As String

Dim x As Integer

Set dbs = OpenDatabase("c:\documents and settings\cmartin\my documents\jeff\document management\Document Inventory Database v1-0.mdb")

For x = 1 To 5

Form_Number_Insert = lbl_Form_Number.Caption
State_Insert = "AZ"

If chk_x = True Then

dbs.Execute "INSERT INTO tbl_Form_State (Form_Number,State_ID) VALUES (Form_Number_Insert,State_Insert);"

End If

Next

dbs.Close

End Sub

I'm getting the error on the opendatabase method

Ciaran
 
Ciarin,

Ok, this is slightly different.

For the first problem, check this thread:

http://www.access-programmers.co.uk...d=209439&sortby=lastpost&sortorder=descending

For your second problem (which you will have soon):

Code:
If Me.chk_x = True Then 
   dbs.Execute "INSERT INTO tbl_Form_State (Form_Number, State_ID) " & _
               "VALUES (" & Me.Form_Number_Insert & ", '" & Me.State_Insert & "');" 
End If

That assumes that Form_Number is an integer and State_ID is alphabetic.

Wayne
 

Users who are viewing this thread

Back
Top Bottom