Table Locked When Trying To Update Via Code Called By A Form

Oct 19, 2005

:eek: :eek: :eek: :eek: :eek: :confused: :confused: :confused:

I am trying to update a database table via a command button on the main form, that uses tabbed sub forms.

The database gets its data from paradox data tables copied our company's
third-party software. These table files are copied from one location to another to stop the paradox database from locking up and giving me errors during the import process of this database. I then link to these files at a pre-determined location on a local computer hard drive.

When I try to run the code below I get the error about the table being
locked by a user or process. As you can see I have tried adding a pause
incase the files are still being copied but this does not seem to be the
problem.

I have used a msg box to confirm that the copying process has completed before starting the make query, but the same error comes up after I click ok.

Can anyone suggest anything else.

As you can see from the simplicity of the code below I am a beginner so take it easy on me, by not taking knowledge for granted. :)

code:
------------------------------------------------------------

Dim response
Dim stDocName As String
Dim stLinkCriteria As String


response = MsgBox("Are you sure that you want to update xxx with Customer
data from xxx?", vbYesNo, "Perform Update")
If response = vbYes Then

‘pause software to let any pending work to be completed
Sleep (5000)

‘close active form
DoCmd.Close

‘close all active forms
Do While Forms.Count > 0
DoCmd.Close acForm, Forms(0).Name
Loop

‘pause software to let any pending work to be completed
Sleep (30000)

‘delete existing file
Kill "c:folderfile DATA.DB"

‘replace with new file
FileCopy "J:Folder
ew_DATA.DB", " c:folderfile DATA.DB "

‘pause software to let any pending work to be completed
Sleep (40000)

DoCmd.SetWarnings False


stDocName = "Make_DATA"
DoCmd.OpenQuery stDocName, acNormal, acEdit

‘pause software to let any pending work to be completed
Sleep (35000)

stDocName = "Make_DATA_SUMMARY"
DoCmd.OpenQuery stDocName, acNormal, acEdit

‘pause software to let any pending work to be completed
Sleep (35000)

stDocName = "qry_Update_ Status"
DoCmd.OpenQuery stDocName, acNormal, acEdit

‘pause software to let any pending work to be completed
Sleep (35000)

‘open up main form when finsihed
stDocName = "main-form"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.SetWarnings True


Else
End If

View Replies


ADVERTISEMENT

General :: MS Access Code To Update (add / Subtract) Value (quantity) On Table / Form

May 15, 2015

I have a 'tblStock' with fields 'ProductID', 'InitialStock', 'Buy', 'Sell' and 'UpdatedStock'. I also have a form 'StockUpdate' add values and also add new records to 'tblStock' .

If I have value [100] for IntialStock quantity, Buy [0] and sell [10], UpdatedStock will be [90] (that's done and fine!).

The problem is, I would like to make the UpdatedStock value [90] to be the NEW InitialStock, so that any BUY or SELL will keep updating the UpdatedStock and making it the NEW InitialStock for the next transactions and so on....

View 8 Replies View Related

Please Help: Password Locked VBA Code! I'm Desperate...

Oct 6, 2005

Hi,

I really hope somebody can help me... I put a password on the VBA code in an Access 2000 database. It's been a long time ago and now I have forgotten the password. I need to modify something urgent in that code, but it is locked now. I don't know the password anymore.

Is there some way to gain access to the VBA code again???
Please if you know a solution I would be very thankful!

:(

View 2 Replies View Related

Trouble With Code When Record Is Locked

May 8, 2005

I'm going live with my DB tomorrow morning. I wanted to to Edited Records for my lock type but ran into a problem, this weekend when I took it to our office and had it on multiple computers for the first time. (I've been designing at my house, in my spare time (right), so I couldn't test for the problem I have now.) When a user is on a record and I open the same record up on another computer it locks ok and shows in the Record Selector that it's locked but if I begin to tab through the form I have at least one code that pukes. In my LastName field, in the On Exit event, I have the following code:
If Not (IsNull(Me.LastName)) Then
Me.LastName = StrConv(Me.LastName, vbProperCase)
End If
As I try to Exit this field, only when the record is locked, the code pukes. Can some one lend a hand and give some advise on how to prevent this?

Thanks ahead of time,
Shane

View 2 Replies View Related

Reports :: Table Locked When Trying To Print Single Report From Form

Jul 9, 2013

I have a database that has all the employees in my company with basic information. I have a auto number set up for each person. I also have on my form a subform with information about the employee's history in the company. I have bin trying for the last couple weeks, to put a button on my form, that will open up the custom report I made for the one employee, in print preview mode. Everything I have tried gives me a error. The main error I get is The database engine could not lock the table "EmployeeT" because it is already in use by another person or process. If I open the report by itself, then I get all my employees. I am looking to just open a single report from the form I am currently looking at.

I have 2 tables. One Named EmployeeT with all the employees basic information. I have a auto number with the field name EmployeeID.

The 2nd table is called IncidentT, which has its own auto number, and records all the problem/incidents with the employee. For example, lates, if the did not show up, or cancelled out of that day, etc. I have the 2 tables sharing the EmployeeID, sharing the relationship. My main form, has a lot of my information and a subform, Like i said. But no matter what I try I can get rid of that error.

The only way I got it to work without the error, is when I go into properties and change the Record Set Type to Snapshot on both the form and subform. But then I can't edit the form or subform anymore.

View 2 Replies View Related

VBA Code To Update Field In Table

Jun 23, 2012

I am currently trying to add a last updated field for each field on my table. I figure I would have to add a before update code for each field on my form. However, the field that I want to have updated is not located on my form, but just on the table. I would like to have the field on the table updated with the last user and time the field was updated.

View 1 Replies View Related

Could Not Update. Currently Locked

Jul 3, 2007

I recently split my database and created an MDE file. Users were given a copy of the MDE file and the BE is in a shared directory on a server. There are only two users at this point in time inputting data into the database (there will be at least a dozen more in the near future), but every so often one of them experiences being unable to input data from their Form because of this lock condition. Sometimes the condition will go away (if they wait long enough) and they can input data again. Sometimes it's User A experiencing the lock, sometimes it's User B. I thought splitting would alleviate lock issues, but it doesn't seem to be the case for me. Could this be a "permissions" issue on the shared directory where the BE is located or some security setting within Access (or both)?

Thanks in advance for everyones help!
Michael

View 2 Replies View Related

Could Not Update Currently Locked

Dec 21, 2007

I have two db's a front end and a back end db. One of my users recently got this error "Could not update currently locked" Access "3218". I have a form tied to a table. She changed a drop down that puts an ID in the table row and the error occurred. This has never happend before and the locking is set to "No Lock". She swears nobody else was in that specific form either. How does this error occur out of no where? I did add 3 new columns to that table for a total of 30 columns. The front end is local and the back end is on a shared drive. Honestly if anyone can help I would be so so greatful. There is no code used to update this row in the table. As soon as she hits the drop down the new row is created in the table.

Thank You
Jerry

View 1 Replies View Related

Could Not Update; Currently Locked

Mar 24, 2008

I have a quick question. I have a database that is split into the front end and the back end. The back end is stored on a network drive and the front end is housed on several different employees' hard drives. It was my understanding that splitting the database would prevent messages such as "Could Not Update; Currently Locked". However, I am still receiving this message. Is there something that I can do to prevent this error from occuring?

View 6 Replies View Related

Could Not Update Currently Locked

Dec 21, 2007

I have two db's a front end and a back end db. One of my users recently got this error "Could not update currently locked" Access "3218". I have a form tied to a table. She changed a drop down that puts an ID in the table row and the error occurred. This has never happend before and the locking is set to "No Lock". She swears nobody else was in that specific form either. How does this error occur out of no where? I did add 3 new columns to that table for a total of 30 columns. The front end is local and the back end is on a shared drive. Honestly if anyone can help I would be so so greatful. There is no code used to update this row in the table. As soon as she hits the drop down the new row is created in the table.

Thank You
Jerry

View 1 Replies View Related

Is Form Name Available In Called Module

Aug 27, 2015

Is the calling Form name or the event handler's sub name available in called module? I need it in order to determine the form's name as in [Forms]!someformname!some control.

View 7 Replies View Related

How To Propagate CB Value To Another Called Form

Aug 11, 2011

Is there an easy way to propogate a value from one form to another?

I have two forms: Form A and Form B

Form A is the main: it contains many field including a Supplier CB.
Form B allows the user to add a new supplier if it is not on the list..

Form A allow user to pick a list from the table of suppliers. I allowed edit ietm list in the properties to add the list of suppliers to grow as new supplier are entered. I pointed the user to Form B ton enter the new supplier.

Things going well as I planed, however it is annoying when I enter the new supplier in Form A and respond "yes" to add new items I have to retype the new supplier in Form B again. I have about 11 fields in Form A that will follow this theme. This will not be user friendly if not fixed.

View 4 Replies View Related

Error 3218 Could Not Update; Currently Locked.

Apr 12, 2006

I have a database with 10 users accessing it.
Even though the database is in share mode they get this message "Error 3218 Could not update; currently locked." when they are trying to write a new record.

Any ideas how to fix the problem?

thank you in advace!

View 5 Replies View Related

Forms :: Filter Table In Background Using Text Box Called Badge

Jul 10, 2014

I have a continuous form... and I want to filter the table in the background using the text box called "Badge" (boxed in red in my picture.) You can see the corresponding part over in the filter field. When I display the form, though, Access still asks me for the Badge value, so it's not linking. What formatting am I missing to properly refer to the field?

View 5 Replies View Related

Forms :: Label On Form Will Not Update As The Code Runs In The Background

Mar 17, 2014

I have a userform that pops up when I am implementing a VBA subroutine. The nature of the form is simply to update the user what progress through the operation the code is using a label called lblProgressText.

So, I have a form called frmProgress and in my loop I use:

Code:
DoEvents
Form_frmProgress.lblProgressText.Caption = Format(rsLongItems.PercentPosition / 100, "0.00%") & " - Long items"
Form_frmProgress.pbProgressBar = rsLongItems.PercentPosition
Form_frmProgress.Requery
Form_frmProgress.Refresh
Form_frmProgress.Repaint

I know I don't need the .requery, .repaint and .refresh lines but I put in there just to check it wasn't that causing the issue.

When my code runs, the form is opened using:

Code:
Form_frmProgress.Modal = False
DoCmd.OpenForm Form_frmProgress.Name, acNormal, , , , acWindowNormal

The form Popup property is set to Yes.

The lblProgressText control just wont update (but earlier today it was so maybe I have broken something).Btw, all this code is run from a Module, not in the form object.

View 3 Replies View Related

How Can I Make A Form Always Return To The Form That Called It?

May 16, 2005

I have several forms that can be called from more than one other form, but I need to build my forms so that the user is returned to the form from which they started.

I have looked in the help files and FAQ and I can't find what I am looking for.

Please, can someone direct met to the required information or tell me how to achieve this?

Thanks,
Kev.

View 1 Replies View Related

Modules & VBA :: Error (Invalid Use Of Null) In A Function Called From A Form Current Event

Nov 18, 2013

I am struggling trying to execute a function inside a Form_current event to display some stats.

The Function is this:

Code:
Function FlightsByAircraft(Aircraft As Long) As Long
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim str As String
str = "SELECT * FROM tblFlights WHERE AircraftID = " & Aircraft

[Code] ....

The code for the Form_Current event is this:

Private Sub Form_Current()
txtStats1 = FlightsByAircraft(Me.AircraftID)

Very simple. Well, the problem is when I move to a new record, a error message comes up: "Run-time error '94' - Invalid use of Null". It is because the AircraftID is not populated at that time. I tried to insert in the function code something like that:

Code:
If IsNull(Aircraft) then
exit function
else
.... (the DAO.Recordset code)

but it doesn't work.

View 8 Replies View Related

Locked Table

Apr 13, 2005

Hi I have a problem with my access table - I am seeing the following error even though I am using this in a single user environment, don't have the dreaded .ldb file present and do not have anything else open!

'A query or form bound to the table is open, you do not have permission to open this table in design view, or another user has this table open'

Help! :eek:

View 1 Replies View Related

Access - Locked Table For Editing

Aug 31, 2012

I have a table which is linked to a form which has been working fine for over a year now but yesterday the table "locked" for editing. I can now only copy data from the table. The editing functions delete, cut, new etc are not working, we can still filter the data.If we enter data on the form it creates a new line on the table but we cannot edit directly from the table.

View 6 Replies View Related

Locked Form

Mar 17, 2005

i have an access database in lan and when 2 users are working in the same form and in different record the record will be locked
ex if the first user is changing the date in the fist record the second user cant change another record
http://briefcase.pathfinder.gr/download/adi32/2976/399219/0/test.zip
to check open together the forms table1 table1b and try to change two different records
thank you

View 3 Replies View Related

Locked Form

Aug 8, 2006

Sorry, i'm an access noob.

I have an ADP with a form in it, the form was working correctly until an ex coworker did something to it.

Now the form is locked, when you goto form view you can only view information. You cant edit or add new records, all the fields are locked.

How do I undo this?

View 3 Replies View Related

Forms :: Table Locked When Trying To Print Single Report

Jul 9, 2013

I have a database that has all the employees in my company with basic information. I have a auto number set up for each person. I also have on my form a subform with information about the employee's history in the company. I have bin trying for the last couple weeks, to put a button on my form, that will open up the custom report I made for the one employee, in print preview mode. Everything I have tried gives me a error. The main error I get is The database engine could not lock the table "EmployeeT" because it is already in use by another person or process. If I open the report by itself, then I get all my employees. I am looking to just open a single report from the form I am currently looking at.

I have 2 tables. One Named EmployeeT with all the employees basic information. I have a auto number with the field name EmployeeID. The 2nd table is called IncidentT, which has its own auto number, and records all the problem/incidents with the employee. For example, lates, if the did not show up, or cancelled out of that day, etc. I have the 2 tables sharing the EmployeeID, sharing the relationship. My main form, has a lot of my information and a subform, Like i said. what I try I can get rid of that error.

The only way I got it to work without the error, is when I go into properties and change the Record Set Type to Snapshot on both the form and subform. But then I can't edit the form or subform anymore.

View 10 Replies View Related

"Locked. Could Not Update" Problem

Feb 20, 2008

We have a split database. BE on server and FE on 3 user machines.

If more than 1 of us are accessing the same BE table we often get the message "Locked. Could not update" when we go to print a record or move to the next record.

Now, the FE is identical on all 3 pcs.

e.g. When this happens on PC1 or PC3 and we close the open form on PC2 it resolves the problem.

I have tried all the built in record locking options.
Currently I have it set to "No Locks" and "Open database using record-level locking" is NOT checked. Open mode is "shared".

Can anyone suggest a solution?

How should the record locking be set? The 3 users never need to have access to the same record at the same time.

Thanks

Paul

View 10 Replies View Related

Modules & VBA :: Code To Copy Partial Data To Another Form / Table

Jul 16, 2014

I have prepared a table in a database which includes a yes no box to one of the fields.

The idea of the yes/no field is that this is recording if the record is awarded. What i would like to achieve is that if the yes no box is checked "True" i would like to be able to copy some of the data from this table into a new table and that the form associated with this table opens up to enable the user to populate the remaining fields.

I believe i need to run this as an on click event procedure but cannot identify the code to enable the data to be copied accross to the other table.

View 14 Replies View Related

Queries :: DSum - Update A Field In Specific Table With Info Form Another Table

Aug 5, 2014

I have a table products with a field "id_product" and "total" (Total items in stock)

I have a query with the fields "id_product" and also the field "total in stock"

I want an update query to update the field 'total' in table 'products' with infos from that query

For each id-product in table products, replace the field total with the field 'total in stock' from the query

So I want to update a filed in a specific table with infos form another table.

View 2 Replies View Related

Forms :: Update Data From One Table To Another Table Using Form - Access 2010

Dec 16, 2013

How to update data from one table to another table using form.

I have data coming from design team in Database 1 and using form i want search data and assign the job to a person and store it in the database with his name. I have to do this because database from design team is read only.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved